from djmodels.conf.urls import url from djmodels.urls import path from . import views urlpatterns = [ url(r'^innocent/$', views.innocent), path('redirect/', views.redirect), url(r'^suspicious/$', views.suspicious), url(r'^suspicious_spec/$', views.suspicious_spec), path('internal_server_error/', views.internal_server_error), path('uncaught_exception/', views.uncaught_exception), path('permission_denied/', views.permission_denied), path('multi_part_parser_error/', views.multi_part_parser_error), path('does_not_exist_raised/', views.does_not_exist_raised), ]
from djmodels.conf.urls import url from djmodels.urls import path from djmodels.utils.translation import gettext_lazy as _ from djmodels.views.generic import TemplateView view = TemplateView.as_view(template_name='dummy.html') app_name = 'account' urlpatterns = [ url(_(r'^register/$'), view, name='register'), url(_(r'^register-without-slash$'), view, name='register-without-slash'), path(_('register-as-path/'), view, name='register-as-path'), ]
This may only be used in the root URLconf, not in an included URLconf. """ if not settings.USE_I18N: return list(urls) return [ URLResolver( LocalePrefixPattern( prefix_default_language=prefix_default_language), list(urls), ) ] @functools.lru_cache(maxsize=None) def is_language_prefix_patterns_used(urlconf): """ Return a tuple of two booleans: ( `True` if i18n_patterns() (LocalePrefixPattern) is used in the URLconf, `True` if the default language should be prefixed ) """ for url_pattern in get_resolver(urlconf).url_patterns: if isinstance(url_pattern.pattern, LocalePrefixPattern): return True, url_pattern.pattern.prefix_default_language return False, False urlpatterns = [ path('setlang/', set_language, name='set_language'), ]
from djmodels.conf.urls import url from djmodels.urls import path urlpatterns = [ path('/path-starting-with-slash/', lambda x: x), url(r'/url-starting-with-slash/$', lambda x: x), ]
from djmodels.contrib.flatpages import views from djmodels.urls import path urlpatterns = [ path('<path:url>', views.flatpage, name='djmodels.contrib.flatpages.views.flatpage'), ]
from djmodels.urls import path urlpatterns = [ path('^beginning-with-caret', lambda x: x), ]
from djmodels.urls import path urlpatterns = [ path('ending-with-dollar$', lambda x: x), ]
from djmodels.urls import include, path urlpatterns = [ path('', include([(r'^tuple/$', lambda x: x)])), ]
from djmodels.urls import path urlpatterns = [ path(r'(?P<named-group>\d+)', lambda x: x), ]