Revision: 650
Author: batiste.bieler
Date: Thu Aug 20 09:26:45 2009
Log: Fix issue 150, and partially 151
http://code.google.com/p/django-page-cms/source/detail?r=650

Modified:
  /trunk/example/templates/pages/index.html
  /trunk/pages/admin/__init__.py
  /trunk/pages/http.py
  /trunk/pages/templatetags/pages_tags.py
  /trunk/pages/views.py

=======================================
--- /trunk/example/templates/pages/index.html   Fri Aug 14 09:49:58 2009
+++ /trunk/example/templates/pages/index.html   Thu Aug 20 09:26:45 2009
@@ -64,7 +64,6 @@
  </style>
  </head>
  <body>
-
  <div id="main">
  <p style="float:right">
      {% if user.is_authenticated %}
=======================================
--- /trunk/pages/admin/__init__.py      Fri Aug 14 01:06:31 2009
+++ /trunk/pages/admin/__init__.py      Thu Aug 20 09:26:45 2009
@@ -79,11 +79,6 @@
              'javascript/pages_form.js',
          )]

-    def __init__(self, *args, **kwds):
-        for model, options in get_connected():
-            self.inlines.append(make_inline_admin(model, options))
-        return super(PageAdmin, self).__init__(*args, **kwds)
-
      def __call__(self, request, url):
          """
          Delegate to the appropriate method, based on the URL.
@@ -402,6 +397,9 @@
                       
template_name='admin/pages/page/change_list_table.html')
          return HttpResponseRedirect('../../')

+for model, options in get_connected():
+    PageAdmin.inlines.append(make_inline_admin(model, options))
+
  try:
      admin.site.register(Page, PageAdmin)
  except AlreadyRegistered:
=======================================
--- /trunk/pages/http.py        Fri Aug 14 01:06:31 2009
+++ /trunk/pages/http.py        Thu Aug 20 09:26:45 2009
@@ -55,15 +55,14 @@
      return _dec

  def get_slug_and_relative_path(path):
-    """Split a page path into the slug, and the remaining left
-    part."""
+    """Return the page's slug and complete path."""
      if path[-1] == '/':
          path = path[:-1]
      slug = path.split("/")[-1]
      root = reverse('pages-root')
      if path.startswith(root):
          path = path[len(root):]
-    return slug, path
+    return slug, path + '/'

  def get_template_from_request(request, page=None):
      """
=======================================
--- /trunk/pages/templatetags/pages_tags.py     Fri Aug 14 07:58:29 2009
+++ /trunk/pages/templatetags/pages_tags.py     Thu Aug 20 09:26:45 2009
@@ -216,10 +216,11 @@
              context.update(page_dict)
          except Exception, e:
              pass
+        return ''

  def do_load_pages(parser, token):
      """Load the navigation pages, lang, and current_page variables into the
-    current context
+    current context.

      eg:
      <ul>
@@ -357,18 +358,21 @@
      if 'current_page' in context:
          current_page = context['current_page']
          # if this node is expanded, we also have to render its children
-        # a node is expanded if it is the current node or one of its  
ancestors
+        # a node is expanded if it is the current node or one of its  
ancestors
          if page.lft <= current_page.lft and page.rght >= current_page.rght:
              children = page.get_children_for_frontend()
      return locals()
-
-pages_dynamic_tree_menu =  
register.inclusion_tag('pages/dynamic_tree_menu.html',
-                                                  
takes_context=True)(pages_dynamic_tree_menu)
+pages_dynamic_tree_menu = register.inclusion_tag(
+    'pages/dynamic_tree_menu.html',
+    takes_context=True
+)(pages_dynamic_tree_menu)

  def pages_breadcrumb(context, page, url='/'):
      request = context['request']
      site_id = None
      pages = page.get_ancestors()
      return locals()
-pages_breadcrumb = register.inclusion_tag('pages/breadcrumb.html',
-                                                  
takes_context=True)(pages_breadcrumb)
+pages_breadcrumb = register.inclusion_tag(
+    'pages/breadcrumb.html',
+    takes_context=True
+)(pages_breadcrumb)
=======================================
--- /trunk/pages/views.py       Fri Aug 14 15:01:51 2009
+++ /trunk/pages/views.py       Thu Aug 20 09:26:45 2009
@@ -32,6 +32,9 @@
      if lang is None:
          lang = get_language_from_request(request)

+    if path is None:
+        slug, path = get_slug_and_relative_path(request.path)
+
      context = {
          'path': path,
          'pages': pages,

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pinax-updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/pinax-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to