2011-09-12 00:36:16 +02:00
|
|
|
from django.conf.urls import patterns, url, include
|
2011-10-13 23:34:56 +02:00
|
|
|
|
|
|
|
from .views import view_class_instance
|
|
|
|
|
2009-07-16 18:16:13 +02:00
|
|
|
|
|
|
|
class URLObject(object):
|
|
|
|
def __init__(self, app_name, namespace):
|
|
|
|
self.app_name = app_name
|
|
|
|
self.namespace = namespace
|
|
|
|
|
|
|
|
def urls(self):
|
|
|
|
return patterns('',
|
|
|
|
url(r'^inner/$', 'empty_view', name='urlobject-view'),
|
|
|
|
url(r'^inner/(?P<arg1>\d+)/(?P<arg2>\d+)/$', 'empty_view', name='urlobject-view'),
|
2011-11-07 02:09:13 +01:00
|
|
|
url(r'^inner/\+\\\$\*/$', 'empty_view', name='urlobject-special-view'),
|
2009-07-16 18:16:13 +02:00
|
|
|
), self.app_name, self.namespace
|
|
|
|
urls = property(urls)
|
|
|
|
|
|
|
|
testobj1 = URLObject('testapp', 'test-ns1')
|
|
|
|
testobj2 = URLObject('testapp', 'test-ns2')
|
|
|
|
default_testobj = URLObject('testapp', 'testapp')
|
|
|
|
|
|
|
|
otherobj1 = URLObject('nodefault', 'other-ns1')
|
|
|
|
otherobj2 = URLObject('nodefault', 'other-ns2')
|
|
|
|
|
2013-02-26 13:19:18 +01:00
|
|
|
urlpatterns = patterns('urlpatterns_reverse.views',
|
2009-07-16 18:16:13 +02:00
|
|
|
url(r'^normal/$', 'empty_view', name='normal-view'),
|
|
|
|
url(r'^normal/(?P<arg1>\d+)/(?P<arg2>\d+)/$', 'empty_view', name='normal-view'),
|
2012-09-27 15:06:58 +02:00
|
|
|
url(r'^resolver_match/$', 'pass_resolver_match_view', name='test-resolver-match'),
|
2009-07-16 18:16:13 +02:00
|
|
|
|
2011-11-07 02:09:13 +01:00
|
|
|
url(r'^\+\\\$\*/$', 'empty_view', name='special-view'),
|
|
|
|
|
2010-08-05 09:09:47 +02:00
|
|
|
url(r'^mixed_args/(\d+)/(?P<arg2>\d+)/$', 'empty_view', name='mixed-args'),
|
|
|
|
url(r'^no_kwargs/(\d+)/(\d+)/$', 'empty_view', name='no-kwargs'),
|
|
|
|
|
2010-08-06 15:47:56 +02:00
|
|
|
url(r'^view_class/(?P<arg1>\d+)/(?P<arg2>\d+)/$', view_class_instance, name='view-class'),
|
|
|
|
|
|
|
|
(r'^unnamed/normal/(?P<arg1>\d+)/(?P<arg2>\d+)/$', 'empty_view'),
|
|
|
|
(r'^unnamed/view_class/(?P<arg1>\d+)/(?P<arg2>\d+)/$', view_class_instance),
|
|
|
|
|
2009-07-16 18:16:13 +02:00
|
|
|
(r'^test1/', include(testobj1.urls)),
|
|
|
|
(r'^test2/', include(testobj2.urls)),
|
|
|
|
(r'^default/', include(default_testobj.urls)),
|
|
|
|
|
|
|
|
(r'^other1/', include(otherobj1.urls)),
|
2011-12-23 00:03:48 +01:00
|
|
|
(r'^other[246]/', include(otherobj2.urls)),
|
2009-07-16 18:16:13 +02:00
|
|
|
|
2013-02-26 13:19:18 +01:00
|
|
|
(r'^ns-included[135]/', include('urlpatterns_reverse.included_namespace_urls', namespace='inc-ns1')),
|
|
|
|
(r'^ns-included2/', include('urlpatterns_reverse.included_namespace_urls', namespace='inc-ns2')),
|
2009-07-16 18:16:13 +02:00
|
|
|
|
2013-02-26 13:19:18 +01:00
|
|
|
(r'^included/', include('urlpatterns_reverse.included_namespace_urls')),
|
|
|
|
(r'^inc(?P<outer>\d+)/', include('urlpatterns_reverse.included_urls', namespace='inc-ns5')),
|
2009-07-16 18:16:13 +02:00
|
|
|
|
2013-02-26 13:19:18 +01:00
|
|
|
(r'^ns-outer/(?P<outer>\d+)/', include('urlpatterns_reverse.included_namespace_urls', namespace='inc-outer')),
|
2011-08-12 16:15:50 +02:00
|
|
|
|
2013-02-26 13:19:18 +01:00
|
|
|
(r'^\+\\\$\*/', include('urlpatterns_reverse.namespace_urls', namespace='special')),
|
2009-07-16 18:16:13 +02:00
|
|
|
)
|