diff --git a/django/conf/urls/__init__.py b/django/conf/urls/__init__.py index c58e581cd9..1ec5da82ad 100644 --- a/django/conf/urls/__init__.py +++ b/django/conf/urls/__init__.py @@ -1,22 +1,9 @@ -import warnings - -from django.urls import include, re_path -from django.utils.deprecation import RemovedInDjango40Warning +from django.urls import include from django.views import defaults -__all__ = ['handler400', 'handler403', 'handler404', 'handler500', 'include', 'url'] +__all__ = ['handler400', 'handler403', 'handler404', 'handler500', 'include'] handler400 = defaults.bad_request handler403 = defaults.permission_denied handler404 = defaults.page_not_found handler500 = defaults.server_error - - -def url(regex, view, kwargs=None, name=None): - warnings.warn( - 'django.conf.urls.url() is deprecated in favor of ' - 'django.urls.re_path().', - RemovedInDjango40Warning, - stacklevel=2, - ) - return re_path(regex, view, kwargs, name) diff --git a/docs/ref/urls.txt b/docs/ref/urls.txt index ce14817c22..6d0110af76 100644 --- a/docs/ref/urls.txt +++ b/docs/ref/urls.txt @@ -136,17 +136,6 @@ Helper function to return a URL pattern for serving files in debug mode:: # ... the rest of your URLconf goes here ... ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) -``url()`` -========= - -.. function:: url(regex, view, kwargs=None, name=None) - -This function is an alias to :func:`django.urls.re_path()`. - -.. deprecated:: 3.1 - - Alias of :func:`django.urls.re_path` for backwards compatibility. - ``handler400`` ============== diff --git a/docs/releases/4.0.txt b/docs/releases/4.0.txt index e15023ed66..d8c130db4f 100644 --- a/docs/releases/4.0.txt +++ b/docs/releases/4.0.txt @@ -311,3 +311,5 @@ to remove usage of these features. * The ``NullBooleanField`` model field is removed, except for support in historical migrations. + +* ``django.conf.urls.url()`` is removed. diff --git a/tests/urlpatterns/tests.py b/tests/urlpatterns/tests.py index b6b23ade9e..1cd3523ca5 100644 --- a/tests/urlpatterns/tests.py +++ b/tests/urlpatterns/tests.py @@ -1,12 +1,10 @@ import string import uuid -from django.conf.urls import url as conf_url from django.core.exceptions import ImproperlyConfigured from django.test import SimpleTestCase from django.test.utils import override_settings from django.urls import NoReverseMatch, Resolver404, path, resolve, reverse -from django.utils.deprecation import RemovedInDjango40Warning from .converters import DynamicConverter from .views import empty_view @@ -315,13 +313,3 @@ class ConversionExceptionTests(SimpleTestCase): raise TypeError('This type error propagates.') with self.assertRaisesMessage(TypeError, 'This type error propagates.'): reverse('dynamic', kwargs={'value': object()}) - - -class DeprecationTests(SimpleTestCase): - def test_url_warning(self): - msg = ( - 'django.conf.urls.url() is deprecated in favor of ' - 'django.urls.re_path().' - ) - with self.assertRaisesMessage(RemovedInDjango40Warning, msg): - conf_url(r'^regex/(?P[0-9]+)/$', empty_view, name='regex')