mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Fixed #23276 -- Deprecated passing views as strings to url().
This commit is contained in:
@@ -1,26 +1,27 @@
|
||||
import warnings
|
||||
|
||||
from django.conf.urls import url
|
||||
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
# View has erroneous import
|
||||
url(r'erroneous_inner/$', views.erroneous_view),
|
||||
# Module has erroneous import
|
||||
# Remove in Django 2.0 along with erroneous_views_module as this is only
|
||||
# an issue with string in urlpatterns
|
||||
url(r'erroneous_outer/$', 'urlpatterns_reverse.erroneous_views_module.erroneous_view'),
|
||||
# Module is an unqualified string
|
||||
url(r'erroneous_unqualified/$', 'unqualified_view'),
|
||||
# View does not exist
|
||||
# Remove in Django 2.0 along with erroneous_views_module as this is only
|
||||
# an issue with string in urlpatterns
|
||||
url(r'missing_inner/$', 'urlpatterns_reverse.views.missing_view'),
|
||||
# View is not callable
|
||||
# Remove in Django 2.0 along with erroneous_views_module as this is only
|
||||
# an issue with string in urlpatterns
|
||||
url(r'uncallable/$', 'urlpatterns_reverse.views.uncallable'),
|
||||
# Module does not exist
|
||||
url(r'missing_outer/$', 'urlpatterns_reverse.missing_module.missing_view'),
|
||||
# Regex contains an error (refs #6170)
|
||||
url(r'(regex_error/$', views.empty_view),
|
||||
]
|
||||
# Test deprecated behavior of passing strings as view to url().
|
||||
# Some of these can be removed in Django 2.0 as they aren't convertable to
|
||||
# callabls.
|
||||
with warnings.catch_warnings(record=True):
|
||||
warnings.filterwarnings('ignore', module='django.conf.urls')
|
||||
urlpatterns = [
|
||||
# View has erroneous import
|
||||
url(r'erroneous_inner/$', views.erroneous_view),
|
||||
# Module has erroneous import
|
||||
url(r'erroneous_outer/$', 'urlpatterns_reverse.erroneous_views_module.erroneous_view'),
|
||||
# Module is an unqualified string
|
||||
url(r'erroneous_unqualified/$', 'unqualified_view'),
|
||||
# View does not exist
|
||||
url(r'missing_inner/$', 'urlpatterns_reverse.views.missing_view'),
|
||||
# View is not callable
|
||||
url(r'uncallable/$', 'urlpatterns_reverse.views.uncallable'),
|
||||
# Module does not exist
|
||||
url(r'missing_outer/$', 'urlpatterns_reverse.missing_module.missing_view'),
|
||||
# Regex contains an error (refs #6170)
|
||||
url(r'(regex_error/$', views.empty_view),
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user