Changeset 2074
- Timestamp:
- 07/03/09 16:08:39 (9 months ago)
- Location:
- branches/0.9/pylucid_project
- Files:
-
- 8 modified
-
apps/pylucid/models.py (modified) (2 diffs)
-
apps/pylucid/templates/admin/base_site.html (modified) (1 diff)
-
apps/pylucid/templatetags/__init__.py (modified) (1 diff)
-
apps/pylucid/views.py (modified) (1 diff)
-
apps/pylucid_admin/urls.py (modified) (1 diff)
-
apps/pylucid_admin/views.py (modified) (2 diffs)
-
pylucid_plugins/admin_menu/views.py (modified) (4 diffs)
-
pylucid_plugins/page_admin/admin_views.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/0.9/pylucid_project/apps/pylucid/models.py
r2072 r2074 57 57 slug = models.SlugField(unique=False, help_text="(for building URLs)") 58 58 59 def get_absolute_url(self):60 """ absolute url *without* language code (without domain/host part) """61 if self.parent:62 parent_shortcut = self.parent.get_absolute_url()63 return parent_shortcut + self.slug + "/"64 else:65 return "/" + self.slug + "/"66 67 59 def __unicode__(self): 68 60 return u"%r tree object (%r)" % (self.slug, self.get_absolute_url()) … … 101 93 view_name = models.CharField(max_length=150, help_text="The view name") 102 94 103 95 def get_absolute_url(self): 96 """ absolute url *without* language code (without domain/host part) """ 97 98 return reverse( 99 viewname="PyLucidAdmin-do", 100 kwargs={"plugin_name":self.plugin_name, "view_name":self.view_name} 101 ) 102 103 if self.parent: 104 parent_shortcut = self.parent.get_absolute_url() 105 return parent_shortcut + self.slug + "/" 106 else: 107 return "/".join(["", settings.ADMIN_URL_PREFIX, self.slug, ""]) 104 108 105 109 -
branches/0.9/pylucid_project/apps/pylucid/templates/admin/base_site.html
r2072 r2074 108 108 <a href="{% url PyLucidUpdate-menu %}">{% trans 'update section' %}</a> 109 109 </li> 110 {% lucidTag admin_menu.panel_extras %} 110 111 </ul> 111 112 </li> -
branches/0.9/pylucid_project/apps/pylucid/templatetags/__init__.py
r1853 r2074 1 # use the undocumented django function to add the "lucidTag" to the tag library. 2 # see ./pylucid/defaulttags/__init__.py 3 from django.template import add_to_builtins 4 add_to_builtins('pylucid_project.apps.pylucid.defaulttags') -
branches/0.9/pylucid_project/apps/pylucid/views.py
r2071 r2074 11 11 from pylucid.markup.converter import apply_markup 12 12 from pylucid.models import PageTree, PageContent, ColorScheme, EditableHtmlHeadFile, Language 13 14 15 # use the undocumented django function to add the "lucidTag" to the tag library.16 # see ./pylucid/defaulttags/__init__.py17 from django.template import add_to_builtins18 add_to_builtins('pylucid_project.apps.pylucid.defaulttags')19 13 20 14 -
branches/0.9/pylucid_project/apps/pylucid_admin/urls.py
r2072 r2074 22 22 url(r'^menu/$', views.menu, name='PyLucidAdmin-menu'), 23 23 24 url(r'^do/(?P<plugin_name>.*)/(?P<view_name>.*)/$', views.do, name='PyLucidAdmin-do'), 25 24 26 url(r'^install/pylucid/$', views.install_pylucid, name='PyLucidAdmin-install_pylucid'), 25 27 url(r'^install/plugins/$', views.install_plugins, name='PyLucidAdmin-install_plugins'), -
branches/0.9/pylucid_project/apps/pylucid_admin/views.py
r2072 r2074 3 3 import os 4 4 5 from django import http 5 6 from django.conf import settings 6 7 from django.template import RequestContext … … 26 27 context_instance=RequestContext(request) 27 28 ) 29 30 def do(request, plugin_name, view_name): 31 plugin = pylucid_plugins.PLUGINS[plugin_name] 32 33 response = plugin.call_plugin_view( 34 request, settings.ADMIN.VIEW_FILENAME, view_name, method_kwargs={} 35 ) 36 if not isinstance(response, http.HttpResponse): 37 raise RuntimeError( 38 "Plugin view %s.%s must return a django.http.HttpResponse object! (it returns: %r)" % ( 39 plugin_name, view_name, type(response) 40 ) 41 ) 42 43 return response 28 44 29 45 -
branches/0.9/pylucid_project/pylucid_plugins/admin_menu/views.py
r2037 r2074 6 6 from django.shortcuts import render_to_response 7 7 8 from pylucid.models import PageTree 8 from pylucid.models import PageTree, PyLucidAdminPage 9 9 10 10 … … 15 15 if not request.user.is_authenticated(): 16 16 # Don't insert the admin top menu 17 return 18 17 return 18 19 19 pagetree = request.PYLUCID.pagetree # Current PageTree model instance 20 20 if pagetree.type == PageTree.PLUGIN_TYPE: … … 23 23 pagecontent = request.PYLUCID.pagecontent 24 24 edit_admin_panel_link = reverse("admin_pylucid_pagecontent_change", args=(pagecontent.id,)) 25 25 26 26 pagemeta = request.PYLUCID.pagemeta # Current PageMeta model instance 27 27 edit_meta_admin_panel_link = reverse("admin_pylucid_pagemeta_change", args=(pagemeta.id,)) 28 28 29 29 context = { 30 30 "logout_link": "?auth=logout", 31 31 32 32 "edit_page_link": "?page_admin=inline_edit", 33 33 34 34 "edit_admin_panel_link": edit_admin_panel_link, 35 35 "edit_meta_admin_panel_link": edit_meta_admin_panel_link, … … 37 37 "admin_menu_link": reverse("admin_index"), 38 38 } 39 return render_to_response('admin_menu/admin_top_menu.html', context, 39 return render_to_response('admin_menu/admin_top_menu.html', context, 40 40 context_instance=RequestContext(request) 41 41 ) 42 43 def panel_extras(request): 44 items = PyLucidAdminPage.objects.all() 45 output = [] 46 for item in items: 47 output.append( 48 '<li><a href="%s" title="%s">%s</a></li>' % (item.get_absolute_url(), item.title, item.name) 49 ) 50 return "\n".join(output) -
branches/0.9/pylucid_project/pylucid_plugins/page_admin/admin_views.py
r2072 r2074 1 1 2 from django.template import RequestContext 3 from django.shortcuts import render_to_response 4 from django.contrib.auth.models import User, Group 2 5 from django.utils.translation import ugettext_lazy as _ 3 from django.contrib.auth.models import User, Group4 6 5 7 from pylucid.models import PyLucidAdminPage, Design … … 64 66 65 67 def new_content_page(request): 66 return """ Create a new page """ 68 context = { 69 "title": "Create a new page", 70 "content": "TODO", 71 } 72 return render_to_response('admin/base_site.html', context, 73 context_instance=RequestContext(request) 74 ) 67 75 68 76 def new_plugin_page(request): 69 return """ Create a new plugin page """ 70 77 context = { 78 "title": "Create a new plugin page", 79 "content": "TODO", 80 } 81 return render_to_response('admin/base_site.html', context, 82 context_instance=RequestContext(request) 83 )