summaryrefslogtreecommitdiff
path: root/django/conf/urls/__init__.py
diff options
context:
space:
mode:
authorSjoerd Job Postmus <sjoerdjob@sjec.nl>2016-10-20 19:29:04 +0200
committerTim Graham <timograham@gmail.com>2017-09-20 18:04:42 -0400
commitdf41b5a05d4e00e80e73afe629072e37873e767a (patch)
treebaaf71ae695e2d3af604ea0d663284cb406c71e4 /django/conf/urls/__init__.py
parentc4c128d67c7dc2830631c6859a204c9d259f1fb1 (diff)
Fixed #28593 -- Added a simplified URL routing syntax per DEP 0201.
Thanks Aymeric Augustin for shepherding the DEP and patch review. Thanks Marten Kenbeek and Tim Graham for contributing to the code. Thanks Tom Christie, Shai Berger, and Tim Graham for the docs.
Diffstat (limited to 'django/conf/urls/__init__.py')
-rw-r--r--django/conf/urls/__init__.py11
1 files changed, 2 insertions, 9 deletions
diff --git a/django/conf/urls/__init__.py b/django/conf/urls/__init__.py
index b7ad156122..7bda34516b 100644
--- a/django/conf/urls/__init__.py
+++ b/django/conf/urls/__init__.py
@@ -1,4 +1,4 @@
-from django.urls import RegexURLPattern, RegexURLResolver, include
+from django.urls import include, re_path
from django.views import defaults
__all__ = ['handler400', 'handler403', 'handler404', 'handler500', 'include', 'url']
@@ -10,11 +10,4 @@ handler500 = defaults.server_error
def url(regex, view, kwargs=None, name=None):
- if isinstance(view, (list, tuple)):
- # For include(...) processing.
- urlconf_module, app_name, namespace = view
- return RegexURLResolver(regex, urlconf_module, kwargs, app_name=app_name, namespace=namespace)
- elif callable(view):
- return RegexURLPattern(regex, view, kwargs, name)
- else:
- raise TypeError('view must be a callable or a list/tuple in the case of include().')
+ return re_path(regex, view, kwargs, name)