from djmodels.conf.urls import include, url from djmodels.contrib import admin urlpatterns = [ url(r'^admin/', include(admin.site.urls)), ]
from djmodels.conf.urls import include, url urlpatterns = [ url(r'^', include([ url(r'^include-with-dollar$', include([])), ])), ]
from djmodels.conf.urls import include, url common_url_patterns = ([ url(r'^app-ns1/', include([])), url(r'^app-url/', include([])), ], 'app-ns1') urlpatterns = [ url(r'^app-ns1-0/', include(common_url_patterns)), url(r'^app-ns1-1/', include(common_url_patterns)), url(r'^app-some-url/', include(([], 'app'), namespace='app-1')), url(r'^app-some-url-2/', include(([], 'app'), namespace='app-1')) ]
from djmodels.conf.urls import include, url from djmodels.contrib.flatpages.sitemaps import FlatPageSitemap from djmodels.contrib.sitemaps import views # special urls for flatpage test cases urlpatterns = [ url(r'^flatpages/sitemap\.xml$', views.sitemap, {'sitemaps': { 'flatpages': FlatPageSitemap }}, name='djmodels.contrib.sitemaps.views.sitemap'), url(r'^flatpage_root', include('djmodels.contrib.flatpages.urls')), url(r'^accounts/', include('djmodels.contrib.auth.urls')), ]
from djmodels.conf.urls import include, url urlpatterns = [ url(r'^foo/', lambda x: x, name='foo'), # This dollar is ok as it is escaped url(r'^\$', include([ url(r'^bar/$', lambda x: x, name='bar'), ])), ]
from djmodels.conf.urls import include, url common_url_patterns = ([ url(r'^app-ns1/', include([])), url(r'^app-url/', include([])), ], 'common') nested_url_patterns = ([ url(r'^common/', include(common_url_patterns, namespace='nested')), ], 'nested') urlpatterns = [ url(r'^app-ns1-0/', include(common_url_patterns, namespace='app-include-1')), url(r'^app-ns1-1/', include(common_url_patterns, namespace='app-include-2')), # 'nested' is included twice but namespaced by nested-1 and nested-2. url(r'^app-ns1-2/', include(nested_url_patterns, namespace='nested-1')), url(r'^app-ns1-3/', include(nested_url_patterns, namespace='nested-2')), # namespaced URLs inside non-namespaced URLs. url(r'^app-ns1-4/', include([url(r'^abc/', include(common_url_patterns))])), ]
from djmodels.conf.urls import include, url from djmodels.conf.urls.i18n import i18n_patterns from djmodels.utils.translation import gettext_lazy as _ urlpatterns = i18n_patterns( url(_(r'^account/'), include('i18n.patterns.urls.wrong_namespace', namespace='account')), )
from djmodels.conf.urls import include, url from djmodels.conf.urls.i18n import i18n_patterns from djmodels.utils.translation import gettext_lazy as _ from djmodels.views.generic import TemplateView view = TemplateView.as_view(template_name='dummy.html') urlpatterns = [ url(r'^not-prefixed/$', view, name='not-prefixed'), url(r'^not-prefixed-include/', include('i18n.patterns.urls.included')), url(_(r'^translated/$'), view, name='no-prefix-translated'), url(_(r'^translated/(?P<slug>[\w-]+)/$'), view, name='no-prefix-translated-slug'), ] urlpatterns += i18n_patterns( url(r'^prefixed/$', view, name='prefixed'), url(r'^prefixed\.xml$', view, name='prefixed_xml'), url(_(r'^users/$'), view, name='users'), url(_(r'^account/'), include('i18n.patterns.urls.namespace', namespace='account')), )