2015-01-28 20:35:27 +08:00
|
|
|
from django.conf.urls import include, url
|
2011-10-14 05:34:56 +08:00
|
|
|
|
2014-04-02 08:46:34 +08:00
|
|
|
from . import views
|
2011-10-14 05:34:56 +08:00
|
|
|
|
2009-07-17 00:16:13 +08:00
|
|
|
|
|
|
|
class URLObject(object):
|
|
|
|
def __init__(self, app_name, namespace):
|
|
|
|
self.app_name = app_name
|
|
|
|
self.namespace = namespace
|
|
|
|
|
|
|
|
def urls(self):
|
2014-04-02 08:46:34 +08:00
|
|
|
return ([
|
2014-08-12 22:54:42 +08:00
|
|
|
url(r'^inner/$', views.empty_view, name='urlobject-view'),
|
|
|
|
url(r'^inner/(?P<arg1>[0-9]+)/(?P<arg2>[0-9]+)/$', views.empty_view, name='urlobject-view'),
|
|
|
|
url(r'^inner/\+\\\$\*/$', views.empty_view, name='urlobject-special-view'),
|
2014-04-02 08:46:34 +08:00
|
|
|
], self.app_name, self.namespace)
|
2009-07-17 00:16:13 +08:00
|
|
|
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')
|
|
|
|
|
2014-04-02 08:46:34 +08:00
|
|
|
urlpatterns = [
|
|
|
|
url(r'^normal/$', views.empty_view, name='normal-view'),
|
2014-04-15 02:12:44 +08:00
|
|
|
url(r'^normal/(?P<arg1>[0-9]+)/(?P<arg2>[0-9]+)/$', views.empty_view, name='normal-view'),
|
2014-04-02 08:46:34 +08:00
|
|
|
url(r'^resolver_match/$', views.pass_resolver_match_view, name='test-resolver-match'),
|
2009-07-17 00:16:13 +08:00
|
|
|
|
2014-04-02 08:46:34 +08:00
|
|
|
url(r'^\+\\\$\*/$', views.empty_view, name='special-view'),
|
2011-11-07 09:09:13 +08:00
|
|
|
|
2014-04-15 02:12:44 +08:00
|
|
|
url(r'^mixed_args/([0-9]+)/(?P<arg2>[0-9]+)/$', views.empty_view, name='mixed-args'),
|
|
|
|
url(r'^no_kwargs/([0-9]+)/([0-9]+)/$', views.empty_view, name='no-kwargs'),
|
2010-08-05 15:09:47 +08:00
|
|
|
|
2014-04-15 02:12:44 +08:00
|
|
|
url(r'^view_class/(?P<arg1>[0-9]+)/(?P<arg2>[0-9]+)/$', views.view_class_instance, name='view-class'),
|
2010-08-06 21:47:56 +08:00
|
|
|
|
2014-04-15 02:12:44 +08:00
|
|
|
url(r'^unnamed/normal/(?P<arg1>[0-9]+)/(?P<arg2>[0-9]+)/$', views.empty_view),
|
|
|
|
url(r'^unnamed/view_class/(?P<arg1>[0-9]+)/(?P<arg2>[0-9]+)/$', views.view_class_instance),
|
2010-08-06 21:47:56 +08:00
|
|
|
|
2014-04-02 08:46:34 +08:00
|
|
|
url(r'^test1/', include(testobj1.urls)),
|
|
|
|
url(r'^test2/', include(testobj2.urls)),
|
|
|
|
url(r'^default/', include(default_testobj.urls)),
|
2009-07-17 00:16:13 +08:00
|
|
|
|
2014-04-02 08:46:34 +08:00
|
|
|
url(r'^other1/', include(otherobj1.urls)),
|
|
|
|
url(r'^other[246]/', include(otherobj2.urls)),
|
2009-07-17 00:16:13 +08:00
|
|
|
|
2014-04-02 08:46:34 +08:00
|
|
|
url(r'^ns-included[135]/', include('urlpatterns_reverse.included_namespace_urls', namespace='inc-ns1')),
|
|
|
|
url(r'^ns-included2/', include('urlpatterns_reverse.included_namespace_urls', namespace='inc-ns2')),
|
2009-07-17 00:16:13 +08:00
|
|
|
|
2014-04-02 08:46:34 +08:00
|
|
|
url(r'^included/', include('urlpatterns_reverse.included_namespace_urls')),
|
2014-04-15 02:12:44 +08:00
|
|
|
url(r'^inc(?P<outer>[0-9]+)/', include('urlpatterns_reverse.included_urls', namespace='inc-ns5')),
|
2009-07-17 00:16:13 +08:00
|
|
|
|
2014-04-15 02:12:44 +08:00
|
|
|
url(r'^ns-outer/(?P<outer>[0-9]+)/', include('urlpatterns_reverse.included_namespace_urls', namespace='inc-outer')),
|
2011-08-12 22:15:50 +08:00
|
|
|
|
2014-04-02 08:46:34 +08:00
|
|
|
url(r'^\+\\\$\*/', include('urlpatterns_reverse.namespace_urls', namespace='special')),
|
|
|
|
]
|