|
1 from django.conf.urls.defaults import * |
|
2 |
|
3 class URLObject(object): |
|
4 def __init__(self, app_name, namespace): |
|
5 self.app_name = app_name |
|
6 self.namespace = namespace |
|
7 |
|
8 def urls(self): |
|
9 return patterns('', |
|
10 url(r'^inner/$', 'empty_view', name='urlobject-view'), |
|
11 url(r'^inner/(?P<arg1>\d+)/(?P<arg2>\d+)/$', 'empty_view', name='urlobject-view'), |
|
12 ), self.app_name, self.namespace |
|
13 urls = property(urls) |
|
14 |
|
15 testobj1 = URLObject('testapp', 'test-ns1') |
|
16 testobj2 = URLObject('testapp', 'test-ns2') |
|
17 default_testobj = URLObject('testapp', 'testapp') |
|
18 |
|
19 otherobj1 = URLObject('nodefault', 'other-ns1') |
|
20 otherobj2 = URLObject('nodefault', 'other-ns2') |
|
21 |
|
22 urlpatterns = patterns('regressiontests.urlpatterns_reverse.views', |
|
23 url(r'^normal/$', 'empty_view', name='normal-view'), |
|
24 url(r'^normal/(?P<arg1>\d+)/(?P<arg2>\d+)/$', 'empty_view', name='normal-view'), |
|
25 |
|
26 (r'^test1/', include(testobj1.urls)), |
|
27 (r'^test2/', include(testobj2.urls)), |
|
28 (r'^default/', include(default_testobj.urls)), |
|
29 |
|
30 (r'^other1/', include(otherobj1.urls)), |
|
31 (r'^other2/', include(otherobj2.urls)), |
|
32 |
|
33 (r'^ns-included1/', include('regressiontests.urlpatterns_reverse.included_namespace_urls', namespace='inc-ns1')), |
|
34 (r'^ns-included2/', include('regressiontests.urlpatterns_reverse.included_namespace_urls', namespace='inc-ns2')), |
|
35 |
|
36 (r'^included/', include('regressiontests.urlpatterns_reverse.included_namespace_urls')), |
|
37 |
|
38 ) |