Revision: 624
Author: batiste.bieler
Date: Mon Aug  3 05:40:39 2009
Log: Add the new way to handle URLs. The old way continue to work for now
http://code.google.com/p/django-page-cms/source/detail?r=624

Modified:
  /trunk/example/urls.py
  /trunk/pages/admin/__init__.py
  /trunk/pages/admin/views.py

=======================================
--- /trunk/example/urls.py      Wed May  6 09:23:35 2009
+++ /trunk/example/urls.py      Mon Aug  3 05:40:39 2009
@@ -7,7 +7,9 @@
  urlpatterns = patterns('',
      (r'^i18n/', include('django.conf.urls.i18n')),
      (r'^pages/', include('pages.urls')),
-    (r'^admin/(.*)', admin.site.root),
+    (r'^admin/', include(admin.site.urls)),
+    # DEPRECATED. This function is the old way of handling URL
+    #(r'^admin/(.*)', admin.site.root),
  )

  if settings.DEBUG:
=======================================
--- /trunk/pages/admin/__init__.py      Fri Jul 31 01:06:52 2009
+++ /trunk/pages/admin/__init__.py      Mon Aug  3 05:40:39 2009
@@ -77,7 +77,12 @@
          )]

      def __call__(self, request, url):
-        """Delegate to the appropriate method, based on the URL."""
+        """
+        Delegate to the appropriate method, based on the URL.
+
+        DEPRECATED. This function is the old way of handling URL  
resolution, and
+        is deprecated in favor of real URL resolution -- see  
``get_urls()``.
+        """
          if url is None:
              return self.list_pages(request)
          elif url == 'jsi18n':
@@ -125,6 +130,31 @@
                      break
          return ret

+    def urls(self):
+        from django.conf.urls.defaults import patterns, url, include
+
+        # Admin-site-wide views.
+        urlpatterns = patterns('',
+            url(r'^$', self.list_pages, name='page-index'),
+             
url(r'^(?P<page_id>[-\w]+)/traduction/(?P<language_id>[-\w]+)/$',
+                traduction, name='page-traduction'),
+             
url(r'^(?P<page_id>[-\w]+)/get-content/(?P<content_id>[-\w]+)/$',
+                get_content, name='page-traduction'),
+             
url(r'^(?P<page_id>[-\w]+)/modify-content/(?P<content_id>[-\w]+)/(?P<language_id>[-\w]+)/$',
+                modify_content, name='page-traduction'),
+            url(r'^(?P<page_id>[-\w]+)/sub-menu/$',
+                sub_menu, name='page-sub-menu'),
+            url(r'^(?P<page_id>[-\w]+)/move-page/$',
+                self.move_page, name='page-traduction'),
+            url(r'^(?P<page_id>[-\w]+)/change-status-(?P<status>[-\w]+)/$',
+                change_status, name='page-change-status'),
+        )
+        urlpatterns += super(PageAdmin, self).urls
+
+        return urlpatterns
+
+    urls = property(urls)
+
      def i18n_javascript(self, request):
          """Displays the i18n JavaScript that the Django admin
          requires.
=======================================
--- /trunk/pages/admin/views.py Mon Jul 13 02:44:51 2009
+++ /trunk/pages/admin/views.py Mon Aug  3 05:40:39 2009
@@ -12,10 +12,11 @@

  def change_status(request, page_id, status):
      """Switch the status of a page."""
+    statuses = {'draft':0,'published':0,'expired':2,'hidden':3}
      if request.method == 'POST':
          try:
              page = Page.objects.get(pk=page_id)
-            page.status = status
+            page.status = statuses[status]
              page.save()
              return HttpResponse(unicode(page.status))
          except:

--~--~---------~--~----~------------~-------~--~----~
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