Permalink
Browse files

Test the urlconf_registry.

  • Loading branch information...
1 parent 3736e5a commit 07d01cb6bc2deab9194f0f269411daa66bec7610 Batiste Bieler committed May 4, 2011
Showing with 11 additions and 5 deletions.
  1. +4 −1 doc/3rd-party-apps.rst
  2. +3 −3 example/settings.py
  3. +4 −1 example/urls.py
@@ -29,13 +29,16 @@ First you need a `urls.py` file that you can register to the CMS. It might look
It's not necessary to decorate your views if you only call them via the CMS or you don't need those variables.
Then you need to register the urlconf module of your application to use it
-within the admin interface. Here is an example for a document application::
+within the admin interface. Put this code in you urls.py `before` admin.autodiscover(). Here is an example for a document application.::
from pages.urlconf_registry import register_urlconf
register_urlconf('Documents', 'pages.testproj.documents.urls',
label='Display documents')
+ # this need to be executed after the registry happened.
+ admin.autodiscover()
+
As soon as you have registered your `urls.py`, a new field will appear in the page administration.
Choose the `Display documents`. The view used to render this page on the frontend
is now choosen by `pages.testproj.documents.urls`.
View
@@ -116,9 +116,9 @@
PAGE_TAGGING = True
PAGE_CONNECTED_MODELS = [{
- 'model':'pages.testproj.documents.models.Document',
- 'form':'pages.testproj.documents.models.DocumentForm',
- 'options':{
+ 'model': 'pages.testproj.documents.models.Document',
+ 'form': 'pages.testproj.documents.models.DocumentForm',
+ 'options': {
'extra': 3,
'max_num': 10,
},
View
@@ -6,6 +6,9 @@
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from pages.views import details
+from pages.urlconf_registry import register_urlconf
+register_urlconf('test', 'pages.testsproject.documents.urls')
+
admin.autodiscover()
authority.autodiscover()
@@ -24,4 +27,4 @@
urlpatterns += patterns('',
# this gonna match /admin if someone forget the traling slash
(r'^', include('pages.urls')),
-)
+)

0 comments on commit 07d01cb

Please sign in to comment.