Updated test URL patterns to use path() and re_path().
This commit is contained in:
parent
1136d57f01
commit
043bd70942
|
@ -1,7 +1,7 @@
|
|||
from django.conf.urls import url
|
||||
from django.urls import path
|
||||
|
||||
from . import admin
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^admin/', admin.site.urls),
|
||||
path('admin/', admin.site.urls),
|
||||
]
|
||||
|
|
|
@ -33,7 +33,7 @@ class ActionAdmin(admin.ModelAdmin):
|
|||
def get_urls(self):
|
||||
# Add the URL of our custom 'add_view' view to the front of the URLs
|
||||
# list. Remove the existing one(s) first
|
||||
from django.conf.urls import url
|
||||
from django.urls import re_path
|
||||
|
||||
def wrap(view):
|
||||
def wrapper(*args, **kwargs):
|
||||
|
@ -45,7 +45,7 @@ class ActionAdmin(admin.ModelAdmin):
|
|||
view_name = '%s_%s_add' % info
|
||||
|
||||
return [
|
||||
url(r'^!add/$', wrap(self.add_view), name=view_name),
|
||||
re_path('^!add/$', wrap(self.add_view), name=view_name),
|
||||
] + self.remove_url(view_name)
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from django.conf.urls import url
|
||||
from django.urls import path
|
||||
|
||||
from .models import site
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^admin/', site.urls),
|
||||
path('admin/', site.urls),
|
||||
]
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
from django.conf.urls import include, url
|
||||
from django.contrib import admin
|
||||
from django.urls import include, path
|
||||
|
||||
from . import views
|
||||
|
||||
backend_urls = ([
|
||||
url(r'^something/$', views.XViewClass.as_view(), name='something'),
|
||||
path('something/', views.XViewClass.as_view(), name='something'),
|
||||
], 'backend')
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
|
||||
url(r'^admin/', admin.site.urls),
|
||||
url(r'^api/backend/', include(backend_urls, namespace='backend')),
|
||||
path('admin/doc/', include('django.contrib.admindocs.urls')),
|
||||
path('admin/', admin.site.urls),
|
||||
path('api/backend/', include(backend_urls, namespace='backend')),
|
||||
]
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
from django.conf.urls import include, url
|
||||
from django.contrib import admin
|
||||
from django.urls import include, path
|
||||
|
||||
from . import views
|
||||
|
||||
ns_patterns = ([
|
||||
url(r'^xview/func/$', views.xview_dec(views.xview), name='func'),
|
||||
path('xview/func/', views.xview_dec(views.xview), name='func'),
|
||||
], 'test')
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^admin/', admin.site.urls),
|
||||
url(r'^admindocs/', include('django.contrib.admindocs.urls')),
|
||||
url(r'^', include(ns_patterns, namespace='test')),
|
||||
url(r'^xview/func/$', views.xview_dec(views.xview)),
|
||||
url(r'^xview/class/$', views.xview_dec(views.XViewClass.as_view())),
|
||||
url(r'^xview/callable_object/$', views.xview_dec(views.XViewCallableObject())),
|
||||
url(r'^xview/callable_object_without_xview/$', views.XViewCallableObject()),
|
||||
path('admin/', admin.site.urls),
|
||||
path('admindocs/', include('django.contrib.admindocs.urls')),
|
||||
path('', include(ns_patterns, namespace='test')),
|
||||
path('xview/func/', views.xview_dec(views.xview)),
|
||||
path('xview/class/', views.xview_dec(views.XViewClass.as_view())),
|
||||
path('xview/callable_object/', views.xview_dec(views.XViewCallableObject())),
|
||||
path('xview/callable_object_without_xview/', views.XViewCallableObject()),
|
||||
]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from django.conf.urls import url
|
||||
from django.urls import path
|
||||
|
||||
from . import admin
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^admin/', admin.site.urls),
|
||||
path('admin/', admin.site.urls),
|
||||
]
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import os
|
||||
|
||||
from django.conf.urls import url
|
||||
from django.urls import path
|
||||
from django.views.static import serve
|
||||
|
||||
here = os.path.dirname(__file__)
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^custom_templates/(?P<path>.*)$', serve, {
|
||||
path('custom_templates/<path:path>', serve, {
|
||||
'document_root': os.path.join(here, 'custom_templates')}),
|
||||
]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from django.conf.urls import url
|
||||
from django.urls import path
|
||||
|
||||
from .admin import site
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^test_admin/admin/', site.urls),
|
||||
path('test_admin/admin/', site.urls),
|
||||
]
|
||||
|
|
|
@ -5,7 +5,6 @@ from io import StringIO
|
|||
from wsgiref.util import FileWrapper
|
||||
|
||||
from django import forms
|
||||
from django.conf.urls import url
|
||||
from django.contrib import admin
|
||||
from django.contrib.admin import BooleanFieldListFilter
|
||||
from django.contrib.admin.views.main import ChangeList
|
||||
|
@ -17,6 +16,7 @@ from django.core.mail import EmailMessage
|
|||
from django.db import models
|
||||
from django.forms.models import BaseModelFormSet
|
||||
from django.http import HttpResponse, StreamingHttpResponse
|
||||
from django.urls import path
|
||||
from django.utils.html import format_html
|
||||
from django.utils.safestring import mark_safe
|
||||
|
||||
|
@ -704,7 +704,7 @@ class ReportAdmin(admin.ModelAdmin):
|
|||
|
||||
def get_urls(self):
|
||||
# Corner case: Don't call parent implementation
|
||||
return [url(r'^extra/$', self.extra, name='cable_extra')]
|
||||
return [path('extra/', self.extra, name='cable_extra')]
|
||||
|
||||
|
||||
class CustomTemplateBooleanFieldListFilter(BooleanFieldListFilter):
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
"""
|
||||
A second, custom AdminSite -- see tests.CustomAdminSiteTests.
|
||||
"""
|
||||
from django.conf.urls import url
|
||||
from django.contrib import admin
|
||||
from django.contrib.auth.admin import UserAdmin
|
||||
from django.contrib.auth.models import User
|
||||
from django.http import HttpResponse
|
||||
from django.urls import path
|
||||
|
||||
from . import admin as base_admin, forms, models
|
||||
|
||||
|
@ -25,7 +25,7 @@ class Admin2(admin.AdminSite):
|
|||
|
||||
def get_urls(self):
|
||||
return [
|
||||
url(r'^my_view/$', self.admin_view(self.my_view), name='my_view'),
|
||||
path('my_view/', self.admin_view(self.my_view), name='my_view'),
|
||||
] + super().get_urls()
|
||||
|
||||
def my_view(self, request):
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
from django.conf.urls import url
|
||||
from django.contrib import admin
|
||||
from django.contrib.admin.actions import delete_selected
|
||||
from django.contrib.auth.models import User
|
||||
from django.test import SimpleTestCase, TestCase, override_settings
|
||||
from django.test.client import RequestFactory
|
||||
from django.urls import reverse
|
||||
from django.urls import path, reverse
|
||||
|
||||
from .models import Article
|
||||
|
||||
|
@ -13,7 +12,7 @@ site.register(User)
|
|||
site.register(Article)
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^test_admin/admin/', site.urls),
|
||||
path('test_admin/admin/', site.urls),
|
||||
]
|
||||
|
||||
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
from unittest import mock
|
||||
|
||||
from django.conf.urls import url
|
||||
from django.contrib import admin
|
||||
from django.contrib.auth.models import User
|
||||
from django.db import connections
|
||||
from django.test import TestCase, override_settings
|
||||
from django.urls import reverse
|
||||
from django.urls import path, reverse
|
||||
|
||||
from .models import Book
|
||||
|
||||
|
@ -23,7 +22,7 @@ site = admin.AdminSite(name='test_adminsite')
|
|||
site.register(Book)
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^admin/', site.urls),
|
||||
path('admin/', site.urls),
|
||||
]
|
||||
|
||||
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
from django.conf.urls import include, url
|
||||
from django.urls import include, path
|
||||
|
||||
from . import admin, custom_has_permission_admin, customadmin, views
|
||||
from .test_autocomplete_view import site as autocomplete_site
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^test_admin/admin/doc/', include('django.contrib.admindocs.urls')),
|
||||
url(r'^test_admin/admin/secure-view/$', views.secure_view, name='secure_view'),
|
||||
url(r'^test_admin/admin/secure-view2/$', views.secure_view2, name='secure_view2'),
|
||||
url(r'^test_admin/admin/', admin.site.urls),
|
||||
url(r'^test_admin/admin2/', customadmin.site.urls),
|
||||
url(r'^test_admin/admin3/', (admin.site.get_urls(), 'admin', 'admin3'), {'form_url': 'pony'}),
|
||||
url(r'^test_admin/admin4/', customadmin.simple_site.urls),
|
||||
url(r'^test_admin/admin5/', admin.site2.urls),
|
||||
url(r'^test_admin/admin6/', admin.site6.urls),
|
||||
url(r'^test_admin/admin7/', admin.site7.urls),
|
||||
path('test_admin/admin/doc/', include('django.contrib.admindocs.urls')),
|
||||
path('test_admin/admin/secure-view/', views.secure_view, name='secure_view'),
|
||||
path('test_admin/admin/secure-view2/', views.secure_view2, name='secure_view2'),
|
||||
path('test_admin/admin/', admin.site.urls),
|
||||
path('test_admin/admin2/', customadmin.site.urls),
|
||||
path('test_admin/admin3/', (admin.site.get_urls(), 'admin', 'admin3'), {'form_url': 'pony'}),
|
||||
path('test_admin/admin4/', customadmin.simple_site.urls),
|
||||
path('test_admin/admin5/', admin.site2.urls),
|
||||
path('test_admin/admin6/', admin.site6.urls),
|
||||
path('test_admin/admin7/', admin.site7.urls),
|
||||
# All admin views accept `extra_context` to allow adding it like this:
|
||||
url(r'^test_admin/admin8/', (admin.site.get_urls(), 'admin', 'admin-extra-context'), {'extra_context': {}}),
|
||||
url(r'^test_admin/admin9/', admin.site9.urls),
|
||||
url(r'^test_admin/admin10/', admin.site10.urls),
|
||||
url(r'^test_admin/has_permission_admin/', custom_has_permission_admin.site.urls),
|
||||
url(r'^test_admin/autocomplete_admin/', autocomplete_site.urls),
|
||||
path('test_admin/admin8/', (admin.site.get_urls(), 'admin', 'admin-extra-context'), {'extra_context': {}}),
|
||||
path('test_admin/admin9/', admin.site9.urls),
|
||||
path('test_admin/admin10/', admin.site10.urls),
|
||||
path('test_admin/has_permission_admin/', custom_has_permission_admin.site.urls),
|
||||
path('test_admin/autocomplete_admin/', autocomplete_site.urls),
|
||||
]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from django.conf.urls import url
|
||||
from django.urls import path
|
||||
|
||||
from . import widgetadmin
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^', widgetadmin.site.urls),
|
||||
path('', widgetadmin.site.urls),
|
||||
]
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
from unittest import mock
|
||||
|
||||
from django.conf.urls import url
|
||||
from django.contrib import admin
|
||||
from django.contrib.auth.admin import UserAdmin
|
||||
from django.contrib.auth.models import User
|
||||
from django.db import connections
|
||||
from django.test import TestCase, override_settings
|
||||
from django.urls import reverse
|
||||
from django.urls import path, reverse
|
||||
|
||||
|
||||
class Router:
|
||||
|
@ -22,7 +21,7 @@ site = admin.AdminSite(name='test_adminsite')
|
|||
site.register(User, admin_class=UserAdmin)
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^admin/', site.urls),
|
||||
path('admin/', site.urls),
|
||||
]
|
||||
|
||||
|
||||
|
|
|
@ -319,7 +319,7 @@ class PasswordResetTest(AuthViewsTestCase):
|
|||
]
|
||||
)
|
||||
def test_confirm_login_post_reset_custom_backend(self):
|
||||
# This backend is specified in the url().
|
||||
# This backend is specified in the URL pattern.
|
||||
backend = 'django.contrib.auth.backends.AllowAllUsersModelBackend'
|
||||
url, path = self._test_confirm_start()
|
||||
path = path.replace('/reset/', '/reset/post_reset_login_custom_backend/')
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
from django.conf.urls import url
|
||||
from django.contrib import admin
|
||||
from django.contrib.auth import views
|
||||
from django.contrib.auth.decorators import login_required, permission_required
|
||||
|
@ -8,7 +7,7 @@ from django.contrib.messages.api import info
|
|||
from django.http import HttpRequest, HttpResponse
|
||||
from django.shortcuts import render
|
||||
from django.template import RequestContext, Template
|
||||
from django.urls import path, reverse_lazy
|
||||
from django.urls import path, re_path, reverse_lazy
|
||||
from django.views.decorators.cache import never_cache
|
||||
|
||||
|
||||
|
@ -82,57 +81,67 @@ uid_token = r'(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z
|
|||
|
||||
# special urls for auth test cases
|
||||
urlpatterns = auth_urlpatterns + [
|
||||
url(r'^logout/custom_query/$', views.LogoutView.as_view(redirect_field_name='follow')),
|
||||
url(r'^logout/next_page/$', views.LogoutView.as_view(next_page='/somewhere/')),
|
||||
url(r'^logout/next_page/named/$', views.LogoutView.as_view(next_page='password_reset')),
|
||||
url(r'^logout/allowed_hosts/$', views.LogoutView.as_view(success_url_allowed_hosts={'otherserver'})),
|
||||
url(r'^remote_user/$', remote_user_auth_view),
|
||||
path('logout/custom_query/', views.LogoutView.as_view(redirect_field_name='follow')),
|
||||
path('logout/next_page/', views.LogoutView.as_view(next_page='/somewhere/')),
|
||||
path('logout/next_page/named/', views.LogoutView.as_view(next_page='password_reset')),
|
||||
path('logout/allowed_hosts/', views.LogoutView.as_view(success_url_allowed_hosts={'otherserver'})),
|
||||
path('remote_user/', remote_user_auth_view),
|
||||
|
||||
url(r'^password_reset_from_email/$',
|
||||
views.PasswordResetView.as_view(from_email='staffmember@example.com')),
|
||||
url(r'^password_reset_extra_email_context/$',
|
||||
path('password_reset_from_email/', views.PasswordResetView.as_view(from_email='staffmember@example.com')),
|
||||
path(
|
||||
'password_reset_extra_email_context/',
|
||||
views.PasswordResetView.as_view(extra_email_context={'greeting': 'Hello!'})),
|
||||
url(r'^password_reset/custom_redirect/$',
|
||||
path(
|
||||
'password_reset/custom_redirect/',
|
||||
views.PasswordResetView.as_view(success_url='/custom/')),
|
||||
url(r'^password_reset/custom_redirect/named/$',
|
||||
path(
|
||||
'password_reset/custom_redirect/named/',
|
||||
views.PasswordResetView.as_view(success_url=reverse_lazy('password_reset'))),
|
||||
url(r'^password_reset/html_email_template/$',
|
||||
path(
|
||||
'password_reset/html_email_template/',
|
||||
views.PasswordResetView.as_view(
|
||||
html_email_template_name='registration/html_password_reset_email.html'
|
||||
)),
|
||||
url(r'^reset/custom/{}/$'.format(uid_token),
|
||||
views.PasswordResetConfirmView.as_view(success_url='/custom/')),
|
||||
url(r'^reset/custom/named/{}/$'.format(uid_token),
|
||||
views.PasswordResetConfirmView.as_view(success_url=reverse_lazy('password_reset'))),
|
||||
url(r'^reset/post_reset_login/{}/$'.format(uid_token),
|
||||
views.PasswordResetConfirmView.as_view(post_reset_login=True)),
|
||||
url(
|
||||
r'^reset/post_reset_login_custom_backend/{}/$'.format(uid_token),
|
||||
re_path(
|
||||
'^reset/custom/{}/$'.format(uid_token),
|
||||
views.PasswordResetConfirmView.as_view(success_url='/custom/'),
|
||||
),
|
||||
re_path(
|
||||
'^reset/custom/named/{}/$'.format(uid_token),
|
||||
views.PasswordResetConfirmView.as_view(success_url=reverse_lazy('password_reset')),
|
||||
),
|
||||
re_path(
|
||||
'^reset/post_reset_login/{}/$'.format(uid_token),
|
||||
views.PasswordResetConfirmView.as_view(post_reset_login=True),
|
||||
),
|
||||
re_path(
|
||||
'^reset/post_reset_login_custom_backend/{}/$'.format(uid_token),
|
||||
views.PasswordResetConfirmView.as_view(
|
||||
post_reset_login=True,
|
||||
post_reset_login_backend='django.contrib.auth.backends.AllowAllUsersModelBackend',
|
||||
),
|
||||
),
|
||||
url(r'^password_change/custom/$',
|
||||
path('password_change/custom/',
|
||||
views.PasswordChangeView.as_view(success_url='/custom/')),
|
||||
url(r'^password_change/custom/named/$',
|
||||
path('password_change/custom/named/',
|
||||
views.PasswordChangeView.as_view(success_url=reverse_lazy('password_reset'))),
|
||||
url(r'^login_required/$', login_required(views.PasswordResetView.as_view())),
|
||||
url(r'^login_required_login_url/$', login_required(views.PasswordResetView.as_view(), login_url='/somewhere/')),
|
||||
path('login_required/', login_required(views.PasswordResetView.as_view())),
|
||||
path('login_required_login_url/', login_required(views.PasswordResetView.as_view(), login_url='/somewhere/')),
|
||||
|
||||
url(r'^auth_processor_no_attr_access/$', auth_processor_no_attr_access),
|
||||
url(r'^auth_processor_attr_access/$', auth_processor_attr_access),
|
||||
url(r'^auth_processor_user/$', auth_processor_user),
|
||||
url(r'^auth_processor_perms/$', auth_processor_perms),
|
||||
url(r'^auth_processor_perm_in_perms/$', auth_processor_perm_in_perms),
|
||||
url(r'^auth_processor_messages/$', auth_processor_messages),
|
||||
url(r'^custom_request_auth_login/$',
|
||||
path('auth_processor_no_attr_access/', auth_processor_no_attr_access),
|
||||
path('auth_processor_attr_access/', auth_processor_attr_access),
|
||||
path('auth_processor_user/', auth_processor_user),
|
||||
path('auth_processor_perms/', auth_processor_perms),
|
||||
path('auth_processor_perm_in_perms/', auth_processor_perm_in_perms),
|
||||
path('auth_processor_messages/', auth_processor_messages),
|
||||
path(
|
||||
'custom_request_auth_login/',
|
||||
views.LoginView.as_view(authentication_form=CustomRequestAuthenticationForm)),
|
||||
url(r'^userpage/(.+)/$', userpage, name="userpage"),
|
||||
url(r'^login/redirect_authenticated_user_default/$', views.LoginView.as_view()),
|
||||
url(r'^login/redirect_authenticated_user/$',
|
||||
re_path('^userpage/(.+)/$', userpage, name='userpage'),
|
||||
path('login/redirect_authenticated_user_default/', views.LoginView.as_view()),
|
||||
path('login/redirect_authenticated_user/',
|
||||
views.LoginView.as_view(redirect_authenticated_user=True)),
|
||||
url(r'^login/allowed_hosts/$',
|
||||
path('login/allowed_hosts/',
|
||||
views.LoginView.as_view(success_url_allowed_hosts={'otherserver'})),
|
||||
|
||||
path('permission_required_redirect/', permission_required_redirect),
|
||||
|
@ -140,5 +149,5 @@ urlpatterns = auth_urlpatterns + [
|
|||
path('login_and_permission_required_exception/', login_and_permission_required_exception),
|
||||
|
||||
# This line is only required to render the password reset with is_admin=True
|
||||
url(r'^admin/', admin.site.urls),
|
||||
path('admin/', admin.site.urls),
|
||||
]
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
Test URLs for auth admins.
|
||||
"""
|
||||
|
||||
from django.conf.urls import url
|
||||
from django.contrib import admin
|
||||
from django.contrib.auth.admin import GroupAdmin, UserAdmin
|
||||
from django.contrib.auth.models import Group, User
|
||||
from django.contrib.auth.urls import urlpatterns
|
||||
from django.urls import path
|
||||
|
||||
# Create a silo'd admin site for just the user/group admins.
|
||||
site = admin.AdminSite(name='auth_test_admin')
|
||||
|
@ -14,5 +14,5 @@ site.register(User, UserAdmin)
|
|||
site.register(Group, GroupAdmin)
|
||||
|
||||
urlpatterns += [
|
||||
url(r'^admin/', site.urls),
|
||||
path('admin/', site.urls),
|
||||
]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from django.conf.urls import url
|
||||
from django.contrib import admin
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.contrib.auth.admin import UserAdmin
|
||||
from django.urls import path
|
||||
|
||||
site = admin.AdminSite(name='custom_user_admin')
|
||||
|
||||
|
@ -19,5 +19,5 @@ class CustomUserAdmin(UserAdmin):
|
|||
site.register(get_user_model(), CustomUserAdmin)
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^admin/', site.urls),
|
||||
path('admin/', site.urls),
|
||||
]
|
||||
|
|
|
@ -20,7 +20,7 @@ class CheckUrlConfigTests(SimpleTestCase):
|
|||
|
||||
@override_settings(ROOT_URLCONF='check_framework.urls.warning_in_include')
|
||||
def test_check_resolver_recursive(self):
|
||||
# The resolver is checked recursively (examining url()s in include()).
|
||||
# The resolver is checked recursively (examining URL patterns in include()).
|
||||
result = check_url_config(None)
|
||||
self.assertEqual(len(result), 1)
|
||||
warning = result[0]
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
from django.conf.urls import url
|
||||
from django.urls import path
|
||||
from django.urls import path, re_path
|
||||
|
||||
urlpatterns = [
|
||||
path('/path-starting-with-slash/', lambda x: x),
|
||||
url(r'/url-starting-with-slash/$', lambda x: x),
|
||||
re_path(r'/url-starting-with-slash/$', lambda x: x),
|
||||
]
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from django.conf.urls import include, url
|
||||
from django.urls import include, re_path
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^include-with-dollar$', include([])),
|
||||
re_path('^include-with-dollar$', include([])),
|
||||
]
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from django.conf.urls import url
|
||||
from django.urls import re_path
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^$', lambda x: x, name='name_with:colon'),
|
||||
re_path('^$', lambda x: x, name='name_with:colon'),
|
||||
]
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
from django.conf.urls import include, url
|
||||
from django.urls import include, path, re_path
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^foo/', lambda x: x, name='foo'),
|
||||
path('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'),
|
||||
re_path(r'^\$', include([
|
||||
path('bar/', lambda x: x, name='bar'),
|
||||
])),
|
||||
]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from django.conf.urls import url
|
||||
from django.conf.urls.i18n import i18n_patterns
|
||||
from django.urls import path
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
urlpatterns = i18n_patterns(
|
||||
url(_('translated/'), lambda x: x, name='i18n_prefixed'),
|
||||
path(_('translated/'), lambda x: x, name='i18n_prefixed'),
|
||||
)
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
from django.conf.urls import include, url
|
||||
from django.urls import include, path
|
||||
|
||||
common_url_patterns = ([
|
||||
url(r'^app-ns1/', include([])),
|
||||
url(r'^app-url/', include([])),
|
||||
path('app-ns1/', include([])),
|
||||
path('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'))
|
||||
path('app-ns1-0/', include(common_url_patterns)),
|
||||
path('app-ns1-1/', include(common_url_patterns)),
|
||||
path('app-some-url/', include(([], 'app'), namespace='app-1')),
|
||||
path('app-some-url-2/', include(([], 'app'), namespace='app-1'))
|
||||
]
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
from django.conf.urls import include, url
|
||||
from django.urls import include, path
|
||||
|
||||
common_url_patterns = ([
|
||||
url(r'^app-ns1/', include([])),
|
||||
url(r'^app-url/', include([])),
|
||||
path('app-ns1/', include([])),
|
||||
path('app-url/', include([])),
|
||||
], 'common')
|
||||
|
||||
nested_url_patterns = ([
|
||||
url(r'^common/', include(common_url_patterns, namespace='nested')),
|
||||
path('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')),
|
||||
path('app-ns1-0/', include(common_url_patterns, namespace='app-include-1')),
|
||||
path('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')),
|
||||
path('app-ns1-2/', include(nested_url_patterns, namespace='nested-1')),
|
||||
path('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))])),
|
||||
path('app-ns1-4/', include([path('abc/', include(common_url_patterns))])),
|
||||
]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from django.conf.urls import include, url
|
||||
from django.urls import include, path, re_path
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^', include([
|
||||
url(r'^include-with-dollar$', include([])),
|
||||
path('', include([
|
||||
re_path('^include-with-dollar$', include([])),
|
||||
])),
|
||||
]
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
from django.conf.urls import url
|
||||
from django.urls import path
|
||||
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
url('^condition/$', views.index),
|
||||
url('^condition/last_modified/$', views.last_modified_view1),
|
||||
url('^condition/last_modified2/$', views.last_modified_view2),
|
||||
url('^condition/etag/$', views.etag_view1),
|
||||
url('^condition/etag2/$', views.etag_view2),
|
||||
url('^condition/unquoted_etag/$', views.etag_view_unquoted),
|
||||
url('^condition/weak_etag/$', views.etag_view_weak),
|
||||
url('^condition/no_etag/$', views.etag_view_none),
|
||||
path('condition/', views.index),
|
||||
path('condition/last_modified/', views.last_modified_view1),
|
||||
path('condition/last_modified2/', views.last_modified_view2),
|
||||
path('condition/etag/', views.etag_view1),
|
||||
path('condition/etag2/', views.etag_view2),
|
||||
path('condition/unquoted_etag/', views.etag_view_unquoted),
|
||||
path('condition/weak_etag/', views.etag_view_weak),
|
||||
path('condition/no_etag/', views.etag_view_none),
|
||||
]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from django.conf.urls import url
|
||||
from django.contrib.contenttypes import views
|
||||
from django.urls import re_path
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^shortcut/([0-9]+)/(.*)/$', views.shortcut),
|
||||
re_path(r'^shortcut/([0-9]+)/(.*)/$', views.shortcut),
|
||||
]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
from django.conf.urls import url
|
||||
from django.urls import path
|
||||
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^request_attrs/$', views.request_processor),
|
||||
url(r'^debug/$', views.debug_processor),
|
||||
path('request_attrs/', views.request_processor),
|
||||
path('debug/', views.debug_processor),
|
||||
]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from django.conf.urls import url
|
||||
from django.http import HttpResponse
|
||||
from django.urls import path
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^$', lambda req: HttpResponse('example view')),
|
||||
path('', lambda req: HttpResponse('example view')),
|
||||
]
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
from django.conf.urls import url
|
||||
from django.urls import path, re_path
|
||||
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^upload/$', views.file_upload_view),
|
||||
url(r'^verify/$', views.file_upload_view_verify),
|
||||
url(r'^unicode_name/$', views.file_upload_unicode_name),
|
||||
url(r'^echo/$', views.file_upload_echo),
|
||||
url(r'^echo_content_type_extra/$', views.file_upload_content_type_extra),
|
||||
url(r'^echo_content/$', views.file_upload_echo_content),
|
||||
url(r'^quota/$', views.file_upload_quota),
|
||||
url(r'^quota/broken/$', views.file_upload_quota_broken),
|
||||
url(r'^getlist_count/$', views.file_upload_getlist_count),
|
||||
url(r'^upload_errors/$', views.file_upload_errors),
|
||||
url(r'^filename_case/$', views.file_upload_filename_case_view),
|
||||
url(r'^fd_closing/(?P<access>t|f)/$', views.file_upload_fd_closing),
|
||||
path('upload/', views.file_upload_view),
|
||||
path('verify/', views.file_upload_view_verify),
|
||||
path('unicode_name/', views.file_upload_unicode_name),
|
||||
path('echo/', views.file_upload_echo),
|
||||
path('echo_content_type_extra/', views.file_upload_content_type_extra),
|
||||
path('echo_content/', views.file_upload_echo_content),
|
||||
path('quota/', views.file_upload_quota),
|
||||
path('quota/broken/', views.file_upload_quota_broken),
|
||||
path('getlist_count/', views.file_upload_getlist_count),
|
||||
path('upload_errors/', views.file_upload_errors),
|
||||
path('filename_case/', views.file_upload_filename_case_view),
|
||||
re_path(r'^fd_closing/(?P<access>t|f)/$', views.file_upload_fd_closing),
|
||||
]
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
from django.conf.urls import include, url
|
||||
from django.contrib.flatpages.sitemaps import FlatPageSitemap
|
||||
from django.contrib.sitemaps import views
|
||||
from django.urls import include, path
|
||||
|
||||
# special urls for flatpage test cases
|
||||
urlpatterns = [
|
||||
url(r'^flatpages/sitemap\.xml$', views.sitemap,
|
||||
path(
|
||||
'flatpages/sitemap.xml', views.sitemap,
|
||||
{'sitemaps': {'flatpages': FlatPageSitemap}},
|
||||
name='django.contrib.sitemaps.views.sitemap'),
|
||||
|
||||
url(r'^flatpage_root', include('django.contrib.flatpages.urls')),
|
||||
url(r'^accounts/', include('django.contrib.auth.urls')),
|
||||
path('flatpage_root', include('django.contrib.flatpages.urls')),
|
||||
path('accounts/', include('django.contrib.auth.urls')),
|
||||
]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from django.conf.urls import url
|
||||
from django.urls import path
|
||||
|
||||
from .views import ArticleFormView
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^model_form/(?P<pk>[0-9]+)/$', ArticleFormView.as_view(), name="article_form"),
|
||||
path('model_form/<int:pk>/', ArticleFormView.as_view(), name='article_form'),
|
||||
]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from django.conf.urls import url
|
||||
from django.urls import path
|
||||
|
||||
from . import admin
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^generic_inline_admin/admin/', admin.site.urls),
|
||||
path('generic_inline_admin/admin/', admin.site.urls),
|
||||
]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from django.conf.urls import include, url
|
||||
from django.contrib import admin
|
||||
from django.urls import include, path
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^admin/', include(admin.site.urls)),
|
||||
path('admin/', include(admin.site.urls)),
|
||||
]
|
||||
|
|
|
@ -1,24 +1,26 @@
|
|||
from django.conf.urls import url
|
||||
from django.contrib.gis import views as gis_views
|
||||
from django.contrib.gis.sitemaps import views as gis_sitemap_views
|
||||
from django.contrib.sitemaps import views as sitemap_views
|
||||
from django.urls import path
|
||||
|
||||
from .feeds import feed_dict
|
||||
from .sitemaps import sitemaps
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^feeds/(?P<url>.*)/$', gis_views.feed, {'feed_dict': feed_dict}),
|
||||
path('feeds/<path:url>/', gis_views.feed, {'feed_dict': feed_dict}),
|
||||
]
|
||||
|
||||
urlpatterns += [
|
||||
url(r'^sitemaps/(?P<section>\w+)\.xml$', sitemap_views.sitemap, {'sitemaps': sitemaps}),
|
||||
path('sitemaps/<section>.xml', sitemap_views.sitemap, {'sitemaps': sitemaps}),
|
||||
]
|
||||
|
||||
urlpatterns += [
|
||||
url(r'^sitemaps/kml/(?P<label>\w+)/(?P<model>\w+)/(?P<field_name>\w+)\.kml$',
|
||||
path(
|
||||
'sitemaps/kml/<label>/<model>/<field_name>.kml',
|
||||
gis_sitemap_views.kml,
|
||||
name='django.contrib.gis.sitemaps.views.kml'),
|
||||
url(r'^sitemaps/kml/(?P<label>\w+)/(?P<model>\w+)/(?P<field_name>\w+)\.kmz$',
|
||||
path(
|
||||
'sitemaps/kml/<label>/<<model>/<field_name>.kmz',
|
||||
gis_sitemap_views.kmz,
|
||||
name='django.contrib.gis.sitemaps.views.kmz'),
|
||||
]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from django.conf.urls import url
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.template.response import TemplateResponse
|
||||
from django.test import SimpleTestCase, modify_settings, override_settings
|
||||
from django.urls import path
|
||||
|
||||
|
||||
class MiddlewareAccessingContent:
|
||||
|
@ -25,7 +25,7 @@ def permission_denied_view(request):
|
|||
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^$', permission_denied_view),
|
||||
path('', permission_denied_view),
|
||||
]
|
||||
|
||||
handler403 = template_response_error_handler
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
from django.conf.urls import url
|
||||
from django.urls import path
|
||||
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^regular/$', views.regular),
|
||||
path('regular/', views.regular),
|
||||
path('no_response_fbv/', views.no_response),
|
||||
path('no_response_cbv/', views.NoResponse()),
|
||||
url(r'^streaming/$', views.streaming),
|
||||
url(r'^in_transaction/$', views.in_transaction),
|
||||
url(r'^not_in_transaction/$', views.not_in_transaction),
|
||||
url(r'^suspicious/$', views.suspicious),
|
||||
url(r'^malformed_post/$', views.malformed_post),
|
||||
url(r'^httpstatus_enum/$', views.httpstatus_enum),
|
||||
path('streaming/', views.streaming),
|
||||
path('in_transaction/', views.in_transaction),
|
||||
path('not_in_transaction/', views.not_in_transaction),
|
||||
path('suspicious/', views.suspicious),
|
||||
path('malformed_post/', views.malformed_post),
|
||||
path('httpstatus_enum/', views.httpstatus_enum),
|
||||
]
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
from django.conf.urls import include, url
|
||||
from django.conf.urls.i18n import i18n_patterns
|
||||
from django.urls import include, path, re_path
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.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'),
|
||||
path('not-prefixed/', view, name='not-prefixed'),
|
||||
path('not-prefixed-include/', include('i18n.patterns.urls.included')),
|
||||
re_path(_(r'^translated/$'), view, name='no-prefix-translated'),
|
||||
re_path(_(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')),
|
||||
path('prefixed/', view, name='prefixed'),
|
||||
path('prefixed.xml', view, name='prefixed_xml'),
|
||||
re_path(_(r'^users/$'), view, name='users'),
|
||||
re_path(_(r'^account/'), include('i18n.patterns.urls.namespace', namespace='account')),
|
||||
)
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
from django.conf.urls import url
|
||||
from django.conf.urls.i18n import i18n_patterns
|
||||
from django.urls import path
|
||||
from django.views.generic import TemplateView
|
||||
|
||||
view = TemplateView.as_view(template_name='dummy.html')
|
||||
|
||||
urlpatterns = i18n_patterns(
|
||||
url(r'^prefixed/$', view, name='prefixed'),
|
||||
path('prefixed/', view, name='prefixed'),
|
||||
)
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
from django.conf.urls import url
|
||||
from django.urls import path
|
||||
from django.views.generic import TemplateView
|
||||
|
||||
view = TemplateView.as_view(template_name='dummy.html')
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^foo/$', view, name='not-prefixed-included-url'),
|
||||
path('foo/', view, name='not-prefixed-included-url'),
|
||||
]
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
from django.conf.urls import url
|
||||
from django.urls import path
|
||||
from django.urls import path, re_path
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.views.generic import TemplateView
|
||||
|
||||
|
@ -7,7 +6,7 @@ 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'),
|
||||
re_path(_(r'^register/$'), view, name='register'),
|
||||
re_path(_(r'^register-without-slash$'), view, name='register-without-slash'),
|
||||
path(_('register-as-path/'), view, name='register-as-path'),
|
||||
]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
from django.conf.urls import url
|
||||
from django.urls import re_path
|
||||
from django.views.generic import TemplateView
|
||||
|
||||
view = TemplateView.as_view(template_name='dummy.html')
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^nl/foo/', view, name='not-translated'),
|
||||
re_path('^nl/foo/', view, name='not-translated'),
|
||||
]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from django.conf.urls import include, url
|
||||
from django.conf.urls.i18n import i18n_patterns
|
||||
from django.urls import include, re_path
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
urlpatterns = i18n_patterns(
|
||||
url(_(r'^account/'), include('i18n.patterns.urls.wrong_namespace', namespace='account')),
|
||||
re_path(_(r'^account/'), include('i18n.patterns.urls.wrong_namespace', namespace='account')),
|
||||
)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from django.conf.urls import url
|
||||
from django.conf.urls.i18n import i18n_patterns
|
||||
from django.urls import re_path
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.views.generic import TemplateView
|
||||
|
||||
|
@ -7,5 +7,5 @@ view = TemplateView.as_view(template_name='dummy.html')
|
|||
|
||||
app_name = 'account'
|
||||
urlpatterns = i18n_patterns(
|
||||
url(_(r'^register/$'), view, name='register'),
|
||||
re_path(_(r'^register/$'), view, name='register'),
|
||||
)
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
from django.conf.urls import url
|
||||
from django.conf.urls.i18n import i18n_patterns
|
||||
from django.http import HttpResponse, StreamingHttpResponse
|
||||
from django.urls import path
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
urlpatterns = i18n_patterns(
|
||||
url(r'^simple/$', lambda r: HttpResponse()),
|
||||
url(r'^streaming/$', lambda r: StreamingHttpResponse([_("Yes"), "/", _("No")])),
|
||||
path('simple/', lambda r: HttpResponse()),
|
||||
path('streaming/', lambda r: StreamingHttpResponse([_('Yes'), '/', _('No')])),
|
||||
)
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
from django.conf.urls import url
|
||||
from django.conf.urls.i18n import i18n_patterns
|
||||
from django.http import HttpResponse
|
||||
from django.urls import path, re_path
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
urlpatterns = i18n_patterns(
|
||||
url(r'^(?P<arg>[\w-]+)-page', lambda request, **arg: HttpResponse(_("Yes"))),
|
||||
url(r'^simple/$', lambda r: HttpResponse(_("Yes"))),
|
||||
url(r'^(.+)/(.+)/$', lambda *args: HttpResponse()),
|
||||
re_path(r'^(?P<arg>[\w-]+)-page', lambda request, **arg: HttpResponse(_('Yes'))),
|
||||
path('simple/', lambda r: HttpResponse(_('Yes'))),
|
||||
re_path(r'^(.+)/(.+)/$', lambda *args: HttpResponse()),
|
||||
prefix_default_language=False,
|
||||
)
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
from django.conf.urls import url
|
||||
from django.urls import path
|
||||
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^innocent/$', views.innocent),
|
||||
path('innocent/', views.innocent),
|
||||
path('redirect/', views.redirect),
|
||||
url(r'^suspicious/$', views.suspicious),
|
||||
url(r'^suspicious_spec/$', views.suspicious_spec),
|
||||
path('suspicious/', views.suspicious),
|
||||
path('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),
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from django.conf.urls import url
|
||||
from django.conf.urls.i18n import i18n_patterns
|
||||
from django.http import HttpResponse
|
||||
from django.urls import path
|
||||
|
||||
urlpatterns = i18n_patterns(
|
||||
url(r'^exists/$', lambda r: HttpResponse()),
|
||||
path('exists/', lambda r: HttpResponse()),
|
||||
)
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
from django import forms
|
||||
from django.conf.urls import url
|
||||
from django.contrib import messages
|
||||
from django.contrib.messages.views import SuccessMessageMixin
|
||||
from django.http import HttpResponse, HttpResponseRedirect
|
||||
from django.template import engines
|
||||
from django.template.response import TemplateResponse
|
||||
from django.urls import reverse
|
||||
from django.urls import path, re_path, reverse
|
||||
from django.views.decorators.cache import never_cache
|
||||
from django.views.generic.edit import FormView
|
||||
|
||||
|
@ -65,10 +64,12 @@ class ContactFormViewWithMsg(SuccessMessageMixin, FormView):
|
|||
|
||||
|
||||
urlpatterns = [
|
||||
url('^add/(debug|info|success|warning|error)/$', add, name='add_message'),
|
||||
url('^add/msg/$', ContactFormViewWithMsg.as_view(), name='add_success_msg'),
|
||||
url('^show/$', show, name='show_message'),
|
||||
url('^template_response/add/(debug|info|success|warning|error)/$',
|
||||
add_template_response, name='add_template_response'),
|
||||
url('^template_response/show/$', show_template_response, name='show_template_response'),
|
||||
re_path('^add/(debug|info|success|warning|error)/$', add, name='add_message'),
|
||||
path('add/msg/', ContactFormViewWithMsg.as_view(), name='add_success_msg'),
|
||||
path('show/', show, name='show_message'),
|
||||
re_path(
|
||||
'^template_response/add/(debug|info|success|warning|error)/$',
|
||||
add_template_response, name='add_template_response',
|
||||
),
|
||||
path('template_response/show/', show_template_response, name='show_template_response'),
|
||||
]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from django.conf.urls import url
|
||||
from django.http import HttpResponse
|
||||
from django.urls import path
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^$', lambda request: HttpResponse('root is here')),
|
||||
path('', lambda request: HttpResponse('root is here')),
|
||||
]
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
from django.conf.urls import url
|
||||
from django.urls import path
|
||||
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^customurlconf/noslash$', views.empty_view),
|
||||
url(r'^customurlconf/slash/$', views.empty_view),
|
||||
url(r'^customurlconf/needsquoting#/$', views.empty_view),
|
||||
path('customurlconf/noslash', views.empty_view),
|
||||
path('customurlconf/slash/', views.empty_view),
|
||||
path('customurlconf/needsquoting#/', views.empty_view),
|
||||
]
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
from django.conf.urls import url
|
||||
from django.urls import path, re_path
|
||||
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^noslash$', views.empty_view),
|
||||
url(r'^slash/$', views.empty_view),
|
||||
url(r'^needsquoting#/$', views.empty_view),
|
||||
path('noslash', views.empty_view),
|
||||
path('slash/', views.empty_view),
|
||||
path('needsquoting#/', views.empty_view),
|
||||
# Accepts paths with two leading slashes.
|
||||
url(r'^(.+)/security/$', views.empty_view),
|
||||
re_path(r'^(.+)/security/$', views.empty_view),
|
||||
]
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
from django.conf.urls import url
|
||||
from django.urls import path
|
||||
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^middleware_exceptions/view/$', views.normal_view),
|
||||
url(r'^middleware_exceptions/error/$', views.server_error),
|
||||
url(r'^middleware_exceptions/permission_denied/$', views.permission_denied),
|
||||
url(r'^middleware_exceptions/exception_in_render/$', views.exception_in_render),
|
||||
url(r'^middleware_exceptions/template_response/$', views.template_response),
|
||||
path('middleware_exceptions/view/', views.normal_view),
|
||||
path('middleware_exceptions/error/', views.server_error),
|
||||
path('middleware_exceptions/permission_denied/', views.permission_denied),
|
||||
path('middleware_exceptions/exception_in_render/', views.exception_in_render),
|
||||
path('middleware_exceptions/template_response/', views.template_response),
|
||||
]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from django.conf.urls import url
|
||||
from django.urls import path
|
||||
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^empty/$', views.empty_view),
|
||||
path('empty/', views.empty_view),
|
||||
]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from django.conf.urls import url
|
||||
from django.urls import path
|
||||
|
||||
from .admin import site
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^admin/', site.urls),
|
||||
path('admin/', site.urls),
|
||||
]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from django.conf.urls import url
|
||||
from django.http import HttpResponse
|
||||
from django.urls import path
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^$', lambda req: HttpResponse('OK')),
|
||||
path('', lambda req: HttpResponse('OK')),
|
||||
]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from django.conf.urls import url
|
||||
from django.urls import path
|
||||
|
||||
|
||||
def some_view(request):
|
||||
|
@ -6,5 +6,5 @@ def some_view(request):
|
|||
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^some-url/$', some_view, name='some-view'),
|
||||
path('some-url/', some_view, name='some-view'),
|
||||
]
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
from django.conf.urls import url
|
||||
from django.urls import path
|
||||
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^example_view/$', views.example_view),
|
||||
url(r'^streaming_example_view/$', views.streaming_example_view),
|
||||
url(r'^model_view/$', views.model_view),
|
||||
url(r'^create_model_instance/$', views.create_model_instance),
|
||||
url(r'^environ_view/$', views.environ_view),
|
||||
url(r'^subview_calling_view/$', views.subview_calling_view),
|
||||
url(r'^subview/$', views.subview),
|
||||
url(r'^check_model_instance_from_subview/$', views.check_model_instance_from_subview),
|
||||
url(r'^method_view/$', views.method_view),
|
||||
path('example_view/', views.example_view),
|
||||
path('streaming_example_view/', views.streaming_example_view),
|
||||
path('model_view/', views.model_view),
|
||||
path('create_model_instance/', views.create_model_instance),
|
||||
path('environ_view/', views.environ_view),
|
||||
path('subview_calling_view/', views.subview_calling_view),
|
||||
path('subview/', views.subview),
|
||||
path('check_model_instance_from_subview/', views.check_model_instance_from_subview),
|
||||
path('method_view/', views.method_view),
|
||||
]
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
from django.conf.urls import url
|
||||
from django.urls import path
|
||||
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^render_to_response/$', views.render_to_response_view),
|
||||
url(r'^render_to_response/multiple_templates/$', views.render_to_response_view_with_multiple_templates),
|
||||
url(r'^render_to_response/content_type/$', views.render_to_response_view_with_content_type),
|
||||
url(r'^render_to_response/status/$', views.render_to_response_view_with_status),
|
||||
url(r'^render_to_response/using/$', views.render_to_response_view_with_using),
|
||||
url(r'^render/$', views.render_view),
|
||||
url(r'^render/multiple_templates/$', views.render_view_with_multiple_templates),
|
||||
url(r'^render/content_type/$', views.render_view_with_content_type),
|
||||
url(r'^render/status/$', views.render_view_with_status),
|
||||
url(r'^render/using/$', views.render_view_with_using),
|
||||
path('render_to_response/', views.render_to_response_view),
|
||||
path('render_to_response/multiple_templates/', views.render_to_response_view_with_multiple_templates),
|
||||
path('render_to_response/content_type/', views.render_to_response_view_with_content_type),
|
||||
path('render_to_response/status/', views.render_to_response_view_with_status),
|
||||
path('render_to_response/using/', views.render_to_response_view_with_using),
|
||||
path('render/', views.render_view),
|
||||
path('render/multiple_templates/', views.render_view_with_multiple_templates),
|
||||
path('render/content_type/', views.render_view_with_content_type),
|
||||
path('render/status/', views.render_view_with_status),
|
||||
path('render/using/', views.render_view_with_using),
|
||||
]
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
from collections import OrderedDict
|
||||
from datetime import date, datetime
|
||||
|
||||
from django.conf.urls import url
|
||||
from django.conf.urls.i18n import i18n_patterns
|
||||
from django.contrib.sitemaps import GenericSitemap, Sitemap, views
|
||||
from django.http import HttpResponse
|
||||
from django.urls import path
|
||||
from django.utils import timezone
|
||||
from django.views.decorators.cache import cache_page
|
||||
|
||||
|
@ -136,64 +136,83 @@ generic_sitemaps_lastmod = {
|
|||
}
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^simple/index\.xml$', views.index, {'sitemaps': simple_sitemaps}),
|
||||
url(r'^simple-paged/index\.xml$', views.index, {'sitemaps': simple_sitemaps_paged}),
|
||||
url(r'^simple-not-callable/index\.xml$', views.index, {'sitemaps': simple_sitemaps_not_callable}),
|
||||
url(r'^simple/custom-index\.xml$', views.index,
|
||||
path('simple/index.xml', views.index, {'sitemaps': simple_sitemaps}),
|
||||
path('simple-paged/index.xml', views.index, {'sitemaps': simple_sitemaps_paged}),
|
||||
path('simple-not-callable/index.xml', views.index, {'sitemaps': simple_sitemaps_not_callable}),
|
||||
path(
|
||||
'simple/custom-index.xml', views.index,
|
||||
{'sitemaps': simple_sitemaps, 'template_name': 'custom_sitemap_index.xml'}),
|
||||
url(r'^simple/sitemap-(?P<section>.+)\.xml$', views.sitemap,
|
||||
path(
|
||||
'simple/sitemap-<section>.xml', views.sitemap,
|
||||
{'sitemaps': simple_sitemaps},
|
||||
name='django.contrib.sitemaps.views.sitemap'),
|
||||
url(r'^simple/sitemap\.xml$', views.sitemap,
|
||||
path(
|
||||
'simple/sitemap.xml', views.sitemap,
|
||||
{'sitemaps': simple_sitemaps},
|
||||
name='django.contrib.sitemaps.views.sitemap'),
|
||||
url(r'^simple/i18n\.xml$', views.sitemap,
|
||||
path(
|
||||
'simple/i18n.xml', views.sitemap,
|
||||
{'sitemaps': simple_i18nsitemaps},
|
||||
name='django.contrib.sitemaps.views.sitemap'),
|
||||
url(r'^simple/custom-sitemap\.xml$', views.sitemap,
|
||||
path(
|
||||
'simple/custom-sitemap.xml', views.sitemap,
|
||||
{'sitemaps': simple_sitemaps, 'template_name': 'custom_sitemap.xml'},
|
||||
name='django.contrib.sitemaps.views.sitemap'),
|
||||
url(r'^empty/sitemap\.xml$', views.sitemap,
|
||||
path(
|
||||
'empty/sitemap.xml', views.sitemap,
|
||||
{'sitemaps': empty_sitemaps},
|
||||
name='django.contrib.sitemaps.views.sitemap'),
|
||||
url(r'^lastmod/sitemap\.xml$', views.sitemap,
|
||||
path(
|
||||
'lastmod/sitemap.xml', views.sitemap,
|
||||
{'sitemaps': fixed_lastmod_sitemaps},
|
||||
name='django.contrib.sitemaps.views.sitemap'),
|
||||
url(r'^lastmod-mixed/sitemap\.xml$', views.sitemap,
|
||||
path(
|
||||
'lastmod-mixed/sitemap.xml', views.sitemap,
|
||||
{'sitemaps': fixed_lastmod__mixed_sitemaps},
|
||||
name='django.contrib.sitemaps.views.sitemap'),
|
||||
url(r'^lastmod/date-sitemap\.xml$', views.sitemap,
|
||||
path(
|
||||
'lastmod/date-sitemap.xml', views.sitemap,
|
||||
{'sitemaps': {'date-sitemap': DateSiteMap}},
|
||||
name='django.contrib.sitemaps.views.sitemap'),
|
||||
url(r'^lastmod/tz-sitemap\.xml$', views.sitemap,
|
||||
path(
|
||||
'lastmod/tz-sitemap.xml', views.sitemap,
|
||||
{'sitemaps': {'tz-sitemap': TimezoneSiteMap}},
|
||||
name='django.contrib.sitemaps.views.sitemap'),
|
||||
url(r'^lastmod-sitemaps/mixed-ascending.xml$', views.sitemap,
|
||||
path(
|
||||
'lastmod-sitemaps/mixed-ascending.xml', views.sitemap,
|
||||
{'sitemaps': sitemaps_lastmod_mixed_ascending},
|
||||
name='django.contrib.sitemaps.views.sitemap'),
|
||||
url(r'^lastmod-sitemaps/mixed-descending.xml$', views.sitemap,
|
||||
path(
|
||||
'lastmod-sitemaps/mixed-descending.xml', views.sitemap,
|
||||
{'sitemaps': sitemaps_lastmod_mixed_descending},
|
||||
name='django.contrib.sitemaps.views.sitemap'),
|
||||
url(r'^lastmod-sitemaps/ascending.xml$', views.sitemap,
|
||||
path(
|
||||
'lastmod-sitemaps/ascending.xml', views.sitemap,
|
||||
{'sitemaps': sitemaps_lastmod_ascending},
|
||||
name='django.contrib.sitemaps.views.sitemap'),
|
||||
url(r'^lastmod-sitemaps/descending.xml$', views.sitemap,
|
||||
path(
|
||||
'lastmod-sitemaps/descending.xml', views.sitemap,
|
||||
{'sitemaps': sitemaps_lastmod_descending},
|
||||
name='django.contrib.sitemaps.views.sitemap'),
|
||||
url(r'^generic/sitemap\.xml$', views.sitemap,
|
||||
path(
|
||||
'generic/sitemap.xml', views.sitemap,
|
||||
{'sitemaps': generic_sitemaps},
|
||||
name='django.contrib.sitemaps.views.sitemap'),
|
||||
url(r'^generic-lastmod/sitemap\.xml$', views.sitemap,
|
||||
path(
|
||||
'generic-lastmod/sitemap.xml', views.sitemap,
|
||||
{'sitemaps': generic_sitemaps_lastmod},
|
||||
name='django.contrib.sitemaps.views.sitemap'),
|
||||
url(r'^cached/index\.xml$', cache_page(1)(views.index),
|
||||
path(
|
||||
'cached/index.xml', cache_page(1)(views.index),
|
||||
{'sitemaps': simple_sitemaps, 'sitemap_url_name': 'cached_sitemap'}),
|
||||
url(r'^cached/sitemap-(?P<section>.+)\.xml', cache_page(1)(views.sitemap),
|
||||
path(
|
||||
'cached/sitemap-<section>.xml', cache_page(1)(views.sitemap),
|
||||
{'sitemaps': simple_sitemaps}, name='cached_sitemap'),
|
||||
url(r'^sitemap-without-entries/sitemap\.xml$', views.sitemap,
|
||||
path(
|
||||
'sitemap-without-entries/sitemap.xml', views.sitemap,
|
||||
{'sitemaps': {}}, name='django.contrib.sitemaps.views.sitemap'),
|
||||
]
|
||||
|
||||
urlpatterns += i18n_patterns(
|
||||
url(r'^i18n/testmodel/(?P<id>\d+)/$', testmodelview, name='i18n_testmodel'),
|
||||
path('i18n/testmodel/<int:id>/', testmodelview, name='i18n_testmodel'),
|
||||
)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from django.conf.urls import url
|
||||
from django.contrib.sitemaps import views
|
||||
from django.urls import path
|
||||
|
||||
from .http import SimpleSitemap
|
||||
|
||||
|
@ -13,8 +13,9 @@ secure_sitemaps = {
|
|||
}
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^secure/index\.xml$', views.index, {'sitemaps': secure_sitemaps}),
|
||||
url(r'^secure/sitemap-(?P<section>.+)\.xml$', views.sitemap,
|
||||
path('secure/index.xml', views.index, {'sitemaps': secure_sitemaps}),
|
||||
path(
|
||||
'secure/sitemap-<section>.xml', views.sitemap,
|
||||
{'sitemaps': secure_sitemaps},
|
||||
name='django.contrib.sitemaps.views.sitemap'),
|
||||
]
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
from django.conf.urls import url
|
||||
from django.contrib.sitemaps import views
|
||||
from django.urls import path
|
||||
|
||||
from .http import simple_sitemaps
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^simple/index\.xml$', views.index, {'sitemaps': simple_sitemaps},
|
||||
path(
|
||||
'simple/index.xml', views.index, {'sitemaps': simple_sitemaps},
|
||||
name='django.contrib.sitemaps.views.index'),
|
||||
]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from django.conf.urls import url
|
||||
from django.contrib.staticfiles import views
|
||||
from django.urls import re_path
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^static/(?P<path>.*)$', views.serve),
|
||||
re_path('^static/(?P<path>.*)$', views.serve),
|
||||
]
|
||||
|
|
|
@ -1,26 +1,28 @@
|
|||
from django.conf.urls import url
|
||||
from django.urls import path
|
||||
|
||||
from . import feeds
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^syndication/rss2/$', feeds.TestRss2Feed()),
|
||||
url(r'^syndication/rss2/guid_ispermalink_true/$',
|
||||
path('syndication/rss2/', feeds.TestRss2Feed()),
|
||||
path(
|
||||
'syndication/rss2/guid_ispermalink_true/',
|
||||
feeds.TestRss2FeedWithGuidIsPermaLinkTrue()),
|
||||
url(r'^syndication/rss2/guid_ispermalink_false/$',
|
||||
path(
|
||||
'syndication/rss2/guid_ispermalink_false/',
|
||||
feeds.TestRss2FeedWithGuidIsPermaLinkFalse()),
|
||||
url(r'^syndication/rss091/$', feeds.TestRss091Feed()),
|
||||
url(r'^syndication/no_pubdate/$', feeds.TestNoPubdateFeed()),
|
||||
url(r'^syndication/atom/$', feeds.TestAtomFeed()),
|
||||
url(r'^syndication/latest/$', feeds.TestLatestFeed()),
|
||||
url(r'^syndication/custom/$', feeds.TestCustomFeed()),
|
||||
url(r'^syndication/naive-dates/$', feeds.NaiveDatesFeed()),
|
||||
url(r'^syndication/aware-dates/$', feeds.TZAwareDatesFeed()),
|
||||
url(r'^syndication/feedurl/$', feeds.TestFeedUrlFeed()),
|
||||
url(r'^syndication/articles/$', feeds.ArticlesFeed()),
|
||||
url(r'^syndication/template/$', feeds.TemplateFeed()),
|
||||
url(r'^syndication/template_context/$', feeds.TemplateContextFeed()),
|
||||
url(r'^syndication/rss2/single-enclosure/$', feeds.TestSingleEnclosureRSSFeed()),
|
||||
url(r'^syndication/rss2/multiple-enclosure/$', feeds.TestMultipleEnclosureRSSFeed()),
|
||||
url(r'^syndication/atom/single-enclosure/$', feeds.TestSingleEnclosureAtomFeed()),
|
||||
url(r'^syndication/atom/multiple-enclosure/$', feeds.TestMultipleEnclosureAtomFeed()),
|
||||
path('syndication/rss091/', feeds.TestRss091Feed()),
|
||||
path('syndication/no_pubdate/', feeds.TestNoPubdateFeed()),
|
||||
path('syndication/atom/', feeds.TestAtomFeed()),
|
||||
path('syndication/latest/', feeds.TestLatestFeed()),
|
||||
path('syndication/custom/', feeds.TestCustomFeed()),
|
||||
path('syndication/naive-dates/', feeds.NaiveDatesFeed()),
|
||||
path('syndication/aware-dates/', feeds.TZAwareDatesFeed()),
|
||||
path('syndication/feedurl/', feeds.TestFeedUrlFeed()),
|
||||
path('syndication/articles/', feeds.ArticlesFeed()),
|
||||
path('syndication/template/', feeds.TemplateFeed()),
|
||||
path('syndication/template_context/', feeds.TemplateContextFeed()),
|
||||
path('syndication/rss2/single-enclosure/', feeds.TestSingleEnclosureRSSFeed()),
|
||||
path('syndication/rss2/multiple-enclosure/', feeds.TestMultipleEnclosureRSSFeed()),
|
||||
path('syndication/atom/single-enclosure/', feeds.TestSingleEnclosureAtomFeed()),
|
||||
path('syndication/atom/multiple-enclosure/', feeds.TestMultipleEnclosureAtomFeed()),
|
||||
]
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
from django.conf.urls import url
|
||||
from django.urls import path
|
||||
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
# View returning a template response
|
||||
url(r'^template_response_view/$', views.template_response_view),
|
||||
path('template_response_view/', views.template_response_view),
|
||||
|
||||
# A view that can be hard to find...
|
||||
url(r'^snark/', views.snark, name='snark'),
|
||||
path('snark/', views.snark, name='snark'),
|
||||
]
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
from django.conf.urls import include, url
|
||||
from django.urls import include, path, re_path
|
||||
|
||||
from . import views
|
||||
|
||||
ns_patterns = [
|
||||
# Test urls for testing reverse lookups
|
||||
url(r'^$', views.index, name='index'),
|
||||
url(r'^client/([0-9,]+)/$', views.client, name='client'),
|
||||
url(r'^client/(?P<id>[0-9]+)/(?P<action>[^/]+)/$', views.client_action, name='client_action'),
|
||||
url(r'^client/(?P<client_id>[0-9]+)/(?P<action>[^/]+)/$', views.client_action, name='client_action'),
|
||||
url(r'^named-client/([0-9]+)/$', views.client2, name="named.client"),
|
||||
path('', views.index, name='index'),
|
||||
re_path(r'^client/([0-9,]+)/$', views.client, name='client'),
|
||||
re_path(r'^client/(?P<id>[0-9]+)/(?P<action>[^/]+)/$', views.client_action, name='client_action'),
|
||||
re_path(r'^client/(?P<client_id>[0-9]+)/(?P<action>[^/]+)/$', views.client_action, name='client_action'),
|
||||
re_path(r'^named-client/([0-9]+)/$', views.client2, name="named.client"),
|
||||
]
|
||||
|
||||
|
||||
urlpatterns = ns_patterns + [
|
||||
# Unicode strings are permitted everywhere.
|
||||
url(r'^Юникод/(\w+)/$', views.client2, name="метка_оператора"),
|
||||
url(r'^Юникод/(?P<tag>\S+)/$', views.client2, name="метка_оператора_2"),
|
||||
re_path(r'^Юникод/(\w+)/$', views.client2, name="метка_оператора"),
|
||||
re_path(r'^Юникод/(?P<tag>\S+)/$', views.client2, name="метка_оператора_2"),
|
||||
|
||||
# Test urls for namespaces and current_app
|
||||
url(r'ns1/', include((ns_patterns, 'app'), 'ns1')),
|
||||
url(r'ns2/', include((ns_patterns, 'app'))),
|
||||
path('ns1/', include((ns_patterns, 'app'), 'ns1')),
|
||||
path('ns2/', include((ns_patterns, 'app'))),
|
||||
]
|
||||
|
|
|
@ -1,47 +1,47 @@
|
|||
from django.conf.urls import url
|
||||
from django.contrib.auth import views as auth_views
|
||||
from django.urls import path
|
||||
from django.views.generic import RedirectView
|
||||
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^upload_view/$', views.upload_view, name='upload_view'),
|
||||
url(r'^get_view/$', views.get_view, name='get_view'),
|
||||
url(r'^post_view/$', views.post_view),
|
||||
url(r'^put_view/$', views.put_view),
|
||||
url(r'^trace_view/$', views.trace_view),
|
||||
url(r'^header_view/$', views.view_with_header),
|
||||
url(r'^raw_post_view/$', views.raw_post_view),
|
||||
url(r'^redirect_view/$', views.redirect_view),
|
||||
url(r'^redirect_view_307/$', views.method_saving_307_redirect_view),
|
||||
url(r'^redirect_view_308/$', views.method_saving_308_redirect_view),
|
||||
url(r'^secure_view/$', views.view_with_secure),
|
||||
url(r'^permanent_redirect_view/$', RedirectView.as_view(url='/get_view/', permanent=True)),
|
||||
url(r'^temporary_redirect_view/$', RedirectView.as_view(url='/get_view/', permanent=False)),
|
||||
url(r'^http_redirect_view/$', RedirectView.as_view(url='/secure_view/')),
|
||||
url(r'^https_redirect_view/$', RedirectView.as_view(url='https://testserver/secure_view/')),
|
||||
url(r'^double_redirect_view/$', views.double_redirect_view),
|
||||
url(r'^bad_view/$', views.bad_view),
|
||||
url(r'^form_view/$', views.form_view),
|
||||
url(r'^form_view_with_template/$', views.form_view_with_template),
|
||||
url(r'^formset_view/$', views.formset_view),
|
||||
url(r'^json_view/$', views.json_view),
|
||||
url(r'^login_protected_view/$', views.login_protected_view),
|
||||
url(r'^login_protected_method_view/$', views.login_protected_method_view),
|
||||
url(r'^login_protected_view_custom_redirect/$', views.login_protected_view_changed_redirect),
|
||||
url(r'^permission_protected_view/$', views.permission_protected_view),
|
||||
url(r'^permission_protected_view_exception/$', views.permission_protected_view_exception),
|
||||
url(r'^permission_protected_method_view/$', views.permission_protected_method_view),
|
||||
url(r'^session_view/$', views.session_view),
|
||||
url(r'^broken_view/$', views.broken_view),
|
||||
url(r'^mail_sending_view/$', views.mail_sending_view),
|
||||
url(r'^mass_mail_sending_view/$', views.mass_mail_sending_view),
|
||||
url(r'^nesting_exception_view/$', views.nesting_exception_view),
|
||||
url(r'^django_project_redirect/$', views.django_project_redirect),
|
||||
url(r'^two_arg_exception/$', views.two_arg_exception),
|
||||
path('upload_view/', views.upload_view, name='upload_view'),
|
||||
path('get_view/', views.get_view, name='get_view'),
|
||||
path('post_view/', views.post_view),
|
||||
path('put_view/', views.put_view),
|
||||
path('trace_view/', views.trace_view),
|
||||
path('header_view/', views.view_with_header),
|
||||
path('raw_post_view/', views.raw_post_view),
|
||||
path('redirect_view/', views.redirect_view),
|
||||
path('redirect_view_307/', views.method_saving_307_redirect_view),
|
||||
path('redirect_view_308/', views.method_saving_308_redirect_view),
|
||||
path('secure_view/', views.view_with_secure),
|
||||
path('permanent_redirect_view/', RedirectView.as_view(url='/get_view/', permanent=True)),
|
||||
path('temporary_redirect_view/', RedirectView.as_view(url='/get_view/', permanent=False)),
|
||||
path('http_redirect_view/', RedirectView.as_view(url='/secure_view/')),
|
||||
path('https_redirect_view/', RedirectView.as_view(url='https://testserver/secure_view/')),
|
||||
path('double_redirect_view/', views.double_redirect_view),
|
||||
path('bad_view/', views.bad_view),
|
||||
path('form_view/', views.form_view),
|
||||
path('form_view_with_template/', views.form_view_with_template),
|
||||
path('formset_view/', views.formset_view),
|
||||
path('json_view/', views.json_view),
|
||||
path('login_protected_view/', views.login_protected_view),
|
||||
path('login_protected_method_view/', views.login_protected_method_view),
|
||||
path('login_protected_view_custom_redirect/', views.login_protected_view_changed_redirect),
|
||||
path('permission_protected_view/', views.permission_protected_view),
|
||||
path('permission_protected_view_exception/', views.permission_protected_view_exception),
|
||||
path('permission_protected_method_view/', views.permission_protected_method_view),
|
||||
path('session_view/', views.session_view),
|
||||
path('broken_view/', views.broken_view),
|
||||
path('mail_sending_view/', views.mail_sending_view),
|
||||
path('mass_mail_sending_view/', views.mass_mail_sending_view),
|
||||
path('nesting_exception_view/', views.nesting_exception_view),
|
||||
path('django_project_redirect/', views.django_project_redirect),
|
||||
path('two_arg_exception/', views.two_arg_exception),
|
||||
|
||||
url(r'^accounts/$', RedirectView.as_view(url='login/')),
|
||||
url(r'^accounts/no_trailing_slash$', RedirectView.as_view(url='login/')),
|
||||
url(r'^accounts/login/$', auth_views.LoginView.as_view(template_name='login.html')),
|
||||
url(r'^accounts/logout/$', auth_views.LogoutView.as_view()),
|
||||
path('accounts/', RedirectView.as_view(url='login/')),
|
||||
path('accounts/no_trailing_slash', RedirectView.as_view(url='login/')),
|
||||
path('accounts/login/', auth_views.LoginView.as_view(template_name='login.html')),
|
||||
path('accounts/logout/', auth_views.LogoutView.as_view()),
|
||||
]
|
||||
|
|
|
@ -1,42 +1,42 @@
|
|||
from django.conf.urls import include, url
|
||||
from django.urls import include, path
|
||||
from django.views.generic import RedirectView
|
||||
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
url(r'', include('test_client.urls')),
|
||||
path('', include('test_client.urls')),
|
||||
|
||||
url(r'^no_template_view/$', views.no_template_view),
|
||||
url(r'^staff_only/$', views.staff_only_view),
|
||||
url(r'^get_view/$', views.get_view),
|
||||
url(r'^request_data/$', views.request_data),
|
||||
url(r'^request_data_extended/$', views.request_data, {'template': 'extended.html', 'data': 'bacon'}),
|
||||
url(r'^arg_view/(?P<name>.+)/$', views.view_with_argument, name='arg_view'),
|
||||
url(r'^nested_view/$', views.nested_view, name='nested_view'),
|
||||
url(r'^login_protected_redirect_view/$', views.login_protected_redirect_view),
|
||||
url(r'^redirects/$', RedirectView.as_view(url='/redirects/further/')),
|
||||
url(r'^redirects/further/$', RedirectView.as_view(url='/redirects/further/more/')),
|
||||
url(r'^redirects/further/more/$', RedirectView.as_view(url='/no_template_view/')),
|
||||
url(r'^redirect_to_non_existent_view/$', RedirectView.as_view(url='/non_existent_view/')),
|
||||
url(r'^redirect_to_non_existent_view2/$', RedirectView.as_view(url='/redirect_to_non_existent_view/')),
|
||||
url(r'^redirect_to_self/$', RedirectView.as_view(url='/redirect_to_self/')),
|
||||
url(r'^redirect_to_self_with_changing_query_view/$', views.redirect_to_self_with_changing_query_view),
|
||||
url(r'^circular_redirect_1/$', RedirectView.as_view(url='/circular_redirect_2/')),
|
||||
url(r'^circular_redirect_2/$', RedirectView.as_view(url='/circular_redirect_3/')),
|
||||
url(r'^circular_redirect_3/$', RedirectView.as_view(url='/circular_redirect_1/')),
|
||||
url(r'^redirect_other_host/$', RedirectView.as_view(url='https://otherserver:8443/no_template_view/')),
|
||||
url(r'^set_session/$', views.set_session_view),
|
||||
url(r'^check_session/$', views.check_session_view),
|
||||
url(r'^request_methods/$', views.request_methods_view),
|
||||
url(r'^check_unicode/$', views.return_unicode),
|
||||
url(r'^check_binary/$', views.return_undecodable_binary),
|
||||
url(r'^json_response/$', views.return_json_response),
|
||||
url(r'^parse_encoded_text/$', views.return_text_file),
|
||||
url(r'^check_headers/$', views.check_headers),
|
||||
url(r'^check_headers_redirect/$', RedirectView.as_view(url='/check_headers/')),
|
||||
url(r'^body/$', views.body),
|
||||
url(r'^read_all/$', views.read_all),
|
||||
url(r'^read_buffer/$', views.read_buffer),
|
||||
url(r'^request_context_view/$', views.request_context_view),
|
||||
url(r'^render_template_multiple_times/$', views.render_template_multiple_times),
|
||||
path('no_template_view/', views.no_template_view),
|
||||
path('staff_only/', views.staff_only_view),
|
||||
path('get_view/', views.get_view),
|
||||
path('request_data/', views.request_data),
|
||||
path('request_data_extended/', views.request_data, {'template': 'extended.html', 'data': 'bacon'}),
|
||||
path('arg_view/<name>/', views.view_with_argument, name='arg_view'),
|
||||
path('nested_view/', views.nested_view, name='nested_view'),
|
||||
path('login_protected_redirect_view/', views.login_protected_redirect_view),
|
||||
path('redirects/', RedirectView.as_view(url='/redirects/further/')),
|
||||
path('redirects/further/', RedirectView.as_view(url='/redirects/further/more/')),
|
||||
path('redirects/further/more/', RedirectView.as_view(url='/no_template_view/')),
|
||||
path('redirect_to_non_existent_view/', RedirectView.as_view(url='/non_existent_view/')),
|
||||
path('redirect_to_non_existent_view2/', RedirectView.as_view(url='/redirect_to_non_existent_view/')),
|
||||
path('redirect_to_self/', RedirectView.as_view(url='/redirect_to_self/')),
|
||||
path('redirect_to_self_with_changing_query_view/', views.redirect_to_self_with_changing_query_view),
|
||||
path('circular_redirect_1/', RedirectView.as_view(url='/circular_redirect_2/')),
|
||||
path('circular_redirect_2/', RedirectView.as_view(url='/circular_redirect_3/')),
|
||||
path('circular_redirect_3/', RedirectView.as_view(url='/circular_redirect_1/')),
|
||||
path('redirect_other_host/', RedirectView.as_view(url='https://otherserver:8443/no_template_view/')),
|
||||
path('set_session/', views.set_session_view),
|
||||
path('check_session/', views.check_session_view),
|
||||
path('request_methods/', views.request_methods_view),
|
||||
path('check_unicode/', views.return_unicode),
|
||||
path('check_binary/', views.return_undecodable_binary),
|
||||
path('json_response/', views.return_json_response),
|
||||
path('parse_encoded_text/', views.return_text_file),
|
||||
path('check_headers/', views.check_headers),
|
||||
path('check_headers_redirect/', RedirectView.as_view(url='/check_headers/')),
|
||||
path('body/', views.body),
|
||||
path('read_all/', views.read_all),
|
||||
path('read_buffer/', views.read_buffer),
|
||||
path('request_context_view/', views.request_context_view),
|
||||
path('render_template_multiple_times/', views.render_template_multiple_times),
|
||||
]
|
||||
|
|
|
@ -5,7 +5,6 @@ from io import StringIO
|
|||
from unittest import mock
|
||||
|
||||
from django.conf import settings
|
||||
from django.conf.urls import url
|
||||
from django.contrib.staticfiles.finders import get_finder, get_finders
|
||||
from django.contrib.staticfiles.storage import staticfiles_storage
|
||||
from django.core.files.storage import default_storage
|
||||
|
@ -22,7 +21,7 @@ from django.test.utils import (
|
|||
CaptureQueriesContext, TestContextDecorator, isolate_apps,
|
||||
override_settings, setup_test_environment,
|
||||
)
|
||||
from django.urls import NoReverseMatch, reverse
|
||||
from django.urls import NoReverseMatch, path, reverse
|
||||
|
||||
from .models import Car, Person, PossessedCar
|
||||
from .views import empty_response
|
||||
|
@ -962,11 +961,11 @@ class AssertURLEqualTests(SimpleTestCase):
|
|||
|
||||
|
||||
class FirstUrls:
|
||||
urlpatterns = [url(r'first/$', empty_response, name='first')]
|
||||
urlpatterns = [path('first/', empty_response, name='first')]
|
||||
|
||||
|
||||
class SecondUrls:
|
||||
urlpatterns = [url(r'second/$', empty_response, name='second')]
|
||||
urlpatterns = [path('second/', empty_response, name='second')]
|
||||
|
||||
|
||||
class SetupTestEnvironmentTests(SimpleTestCase):
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
from django.conf.urls import url
|
||||
from django.urls import path
|
||||
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^test_utils/get_person/([0-9]+)/$', views.get_person),
|
||||
url(r'^test_utils/no_template_used/$', views.no_template_used),
|
||||
path('test_utils/get_person/<int:pk>/', views.get_person),
|
||||
path('test_utils/no_template_used/', views.no_template_used),
|
||||
]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from django.conf.urls import url
|
||||
from django.urls import path
|
||||
|
||||
from . import admin as tz_admin # NOQA: register tz_admin
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^admin/', tz_admin.site.urls),
|
||||
path('admin/', tz_admin.site.urls),
|
||||
]
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
from django.conf.urls import include
|
||||
from django.urls import path, re_path
|
||||
from django.urls import include, path, re_path
|
||||
|
||||
from . import views
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from django.conf.urls import url
|
||||
from django.urls import re_path
|
||||
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
url(r'(regex_error/$', views.empty_view),
|
||||
re_path(r'(regex_error/$', views.empty_view),
|
||||
]
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
Some extra URL patterns that are included at the top level.
|
||||
"""
|
||||
|
||||
from django.conf.urls import include, url
|
||||
from django.urls import include, path, re_path
|
||||
|
||||
from .views import empty_view
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^e-places/([0-9]+)/$', empty_view, name='extra-places'),
|
||||
url(r'^e-people/(?P<name>\w+)/$', empty_view, name="extra-people"),
|
||||
url('', include('urlpatterns_reverse.included_urls2')),
|
||||
url(r'^prefix/(?P<prefix>\w+)/', include('urlpatterns_reverse.included_urls2')),
|
||||
re_path('^e-places/([0-9]+)/$', empty_view, name='extra-places'),
|
||||
re_path(r'^e-people/(?P<name>\w+)/$', empty_view, name='extra-people'),
|
||||
path('', include('urlpatterns_reverse.included_urls2')),
|
||||
re_path(r'^prefix/(?P<prefix>\w+)/', include('urlpatterns_reverse.included_urls2')),
|
||||
]
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
from django.conf.urls import url
|
||||
from django.urls import path, re_path
|
||||
|
||||
from . import views
|
||||
|
||||
app_name = 'inc-app'
|
||||
urlpatterns = [
|
||||
url(r'^normal/$', views.empty_view, name='inc-normal-view'),
|
||||
url(r'^normal/(?P<arg1>[0-9]+)/(?P<arg2>[0-9]+)/$', views.empty_view, name='inc-normal-view'),
|
||||
path('normal/', views.empty_view, name='inc-normal-view'),
|
||||
re_path('^normal/(?P<arg1>[0-9]+)/(?P<arg2>[0-9]+)/$', views.empty_view, name='inc-normal-view'),
|
||||
|
||||
url(r'^\+\\\$\*/$', views.empty_view, name='inc-special-view'),
|
||||
re_path(r'^\+\\\$\*/$', views.empty_view, name='inc-special-view'),
|
||||
|
||||
url(r'^mixed_args/([0-9]+)/(?P<arg2>[0-9]+)/$', views.empty_view, name='inc-mixed-args'),
|
||||
url(r'^no_kwargs/([0-9]+)/([0-9]+)/$', views.empty_view, name='inc-no-kwargs'),
|
||||
re_path('^mixed_args/([0-9]+)/(?P<arg2>[0-9]+)/$', views.empty_view, name='inc-mixed-args'),
|
||||
re_path('^no_kwargs/([0-9]+)/([0-9]+)/$', views.empty_view, name='inc-no-kwargs'),
|
||||
|
||||
url(r'^view_class/(?P<arg1>[0-9]+)/(?P<arg2>[0-9]+)/$', views.view_class_instance, name='inc-view-class'),
|
||||
re_path('^view_class/(?P<arg1>[0-9]+)/(?P<arg2>[0-9]+)/$', views.view_class_instance, name='inc-view-class'),
|
||||
]
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
from django.conf.urls import include, url
|
||||
from django.urls import include, path, re_path
|
||||
|
||||
from .views import empty_view
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^$', empty_view, name="named-url3"),
|
||||
url(r'^extra/(?P<extra>\w+)/$', empty_view, name="named-url4"),
|
||||
url(r'^(?P<one>[0-9]+)|(?P<two>[0-9]+)/$', empty_view),
|
||||
url(r'^included/', include('urlpatterns_reverse.included_named_urls2')),
|
||||
path('', empty_view, name="named-url3"),
|
||||
re_path(r'^extra/(?P<extra>\w+)/$', empty_view, name="named-url4"),
|
||||
re_path(r'^(?P<one>[0-9]+)|(?P<two>[0-9]+)/$', empty_view),
|
||||
path('included/', include('urlpatterns_reverse.included_named_urls2')),
|
||||
]
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
from django.conf.urls import url
|
||||
from django.urls import path, re_path
|
||||
|
||||
from .views import empty_view
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^$', empty_view, name="named-url5"),
|
||||
url(r'^extra/(?P<extra>\w+)/$', empty_view, name="named-url6"),
|
||||
url(r'^(?P<one>[0-9]+)|(?P<two>[0-9]+)/$', empty_view),
|
||||
path('', empty_view, name="named-url5"),
|
||||
re_path(r'^extra/(?P<extra>\w+)/$', empty_view, name="named-url6"),
|
||||
re_path(r'^(?P<one>[0-9]+)|(?P<two>[0-9]+)/$', empty_view),
|
||||
]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from django.conf.urls import include, url
|
||||
from django.urls import include, path, re_path
|
||||
|
||||
from .utils import URLObject
|
||||
from .views import empty_view, view_class_instance
|
||||
|
@ -8,18 +8,18 @@ testobj4 = URLObject('testapp', 'test-ns4')
|
|||
|
||||
app_name = 'included_namespace_urls'
|
||||
urlpatterns = [
|
||||
url(r'^normal/$', empty_view, name='inc-normal-view'),
|
||||
url(r'^normal/(?P<arg1>[0-9]+)/(?P<arg2>[0-9]+)/$', empty_view, name='inc-normal-view'),
|
||||
path('normal/', empty_view, name='inc-normal-view'),
|
||||
re_path('^normal/(?P<arg1>[0-9]+)/(?P<arg2>[0-9]+)/$', empty_view, name='inc-normal-view'),
|
||||
|
||||
url(r'^\+\\\$\*/$', empty_view, name='inc-special-view'),
|
||||
re_path(r'^\+\\\$\*/$', empty_view, name='inc-special-view'),
|
||||
|
||||
url(r'^mixed_args/([0-9]+)/(?P<arg2>[0-9]+)/$', empty_view, name='inc-mixed-args'),
|
||||
url(r'^no_kwargs/([0-9]+)/([0-9]+)/$', empty_view, name='inc-no-kwargs'),
|
||||
re_path('^mixed_args/([0-9]+)/(?P<arg2>[0-9]+)/$', empty_view, name='inc-mixed-args'),
|
||||
re_path('^no_kwargs/([0-9]+)/([0-9]+)/$', empty_view, name='inc-no-kwargs'),
|
||||
|
||||
url(r'^view_class/(?P<arg1>[0-9]+)/(?P<arg2>[0-9]+)/$', view_class_instance, name='inc-view-class'),
|
||||
re_path('^view_class/(?P<arg1>[0-9]+)/(?P<arg2>[0-9]+)/$', view_class_instance, name='inc-view-class'),
|
||||
|
||||
url(r'^test3/', include(*testobj3.urls)),
|
||||
url(r'^test4/', include(*testobj4.urls)),
|
||||
url(r'^ns-included3/', include(('urlpatterns_reverse.included_urls', 'included_urls'), namespace='inc-ns3')),
|
||||
url(r'^ns-included4/', include('urlpatterns_reverse.namespace_urls', namespace='inc-ns4')),
|
||||
path('test3/', include(*testobj3.urls)),
|
||||
path('test4/', include(*testobj4.urls)),
|
||||
path('ns-included3/', include(('urlpatterns_reverse.included_urls', 'included_urls'), namespace='inc-ns3')),
|
||||
path('ns-included4/', include('urlpatterns_reverse.namespace_urls', namespace='inc-ns4')),
|
||||
]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from django.conf.urls import url
|
||||
from django.urls import re_path
|
||||
|
||||
from .views import empty_view
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^inner-no-kwargs/([0-9]+)/', empty_view, name="inner-no-kwargs")
|
||||
re_path('^inner-no-kwargs/([0-9]+)/$', empty_view, name="inner-no-kwargs")
|
||||
]
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
from django.conf.urls import url
|
||||
from django.urls import path, re_path
|
||||
|
||||
from .views import empty_view
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^$', empty_view, name="inner-nothing"),
|
||||
url(r'^extra/(?P<extra>\w+)/$', empty_view, name="inner-extra"),
|
||||
url(r'^(?P<one>[0-9]+)|(?P<two>[0-9]+)/$', empty_view, name="inner-disjunction"),
|
||||
path('', empty_view, name='inner-nothing'),
|
||||
re_path(r'extra/(?P<extra>\w+)/$', empty_view, name='inner-extra'),
|
||||
re_path(r'(?P<one>[0-9]+)|(?P<two>[0-9]+)/$', empty_view, name='inner-disjunction'),
|
||||
]
|
||||
|
|
|
@ -5,11 +5,11 @@ each name to resolve and Django must distinguish the possibilities based on the
|
|||
argument list.
|
||||
"""
|
||||
|
||||
from django.conf.urls import url
|
||||
from django.urls import re_path
|
||||
|
||||
from .views import empty_view
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^part/(?P<value>\w+)/$', empty_view, name="part"),
|
||||
url(r'^part2/(?:(?P<value>\w+)/)?$', empty_view, name="part2"),
|
||||
re_path(r'^part/(?P<value>\w+)/$', empty_view, name='part'),
|
||||
re_path(r'^part2/(?:(?P<value>\w+)/)?$', empty_view, name='part2'),
|
||||
]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from django.conf.urls import url
|
||||
from django.urls import path
|
||||
|
||||
|
||||
class ViewContainer:
|
||||
|
@ -14,6 +14,6 @@ view_container = ViewContainer()
|
|||
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^$', view_container.method_view, name='instance-method-url'),
|
||||
url(r'^$', ViewContainer.classmethod_view, name='instance-method-url'),
|
||||
path('', view_container.method_view, name='instance-method-url'),
|
||||
path('', ViewContainer.classmethod_view, name='instance-method-url'),
|
||||
]
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
from django.conf.urls import include, url
|
||||
from django.urls import include, path, re_path
|
||||
|
||||
from .views import empty_view
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^$', empty_view, name="named-url1"),
|
||||
url(r'^extra/(?P<extra>\w+)/$', empty_view, name="named-url2"),
|
||||
url(r'^(?P<one>[0-9]+)|(?P<two>[0-9]+)/$', empty_view),
|
||||
url(r'^included/', include('urlpatterns_reverse.included_named_urls')),
|
||||
path('', empty_view, name='named-url1'),
|
||||
re_path(r'^extra/(?P<extra>\w+)/$', empty_view, name='named-url2'),
|
||||
re_path(r'^(?P<one>[0-9]+)|(?P<two>[0-9]+)/$', empty_view),
|
||||
path('included/', include('urlpatterns_reverse.included_named_urls')),
|
||||
]
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
from django.conf.urls import url
|
||||
from django.urls import path, re_path
|
||||
|
||||
from .views import empty_view
|
||||
|
||||
urlpatterns = [
|
||||
# No kwargs
|
||||
url(r'^conflict/cannot-go-here/$', empty_view, name='name-conflict'),
|
||||
url(r'^conflict/$', empty_view, name='name-conflict'),
|
||||
path('conflict/cannot-go-here/', empty_view, name='name-conflict'),
|
||||
path('conflict/', empty_view, name='name-conflict'),
|
||||
# One kwarg
|
||||
url(r'^conflict-first/(?P<first>\w+)/$', empty_view, name='name-conflict'),
|
||||
url(r'^conflict-cannot-go-here/(?P<middle>\w+)/$', empty_view, name='name-conflict'),
|
||||
url(r'^conflict-middle/(?P<middle>\w+)/$', empty_view, name='name-conflict'),
|
||||
url(r'^conflict-last/(?P<last>\w+)/$', empty_view, name='name-conflict'),
|
||||
re_path(r'^conflict-first/(?P<first>\w+)/$', empty_view, name='name-conflict'),
|
||||
re_path(r'^conflict-cannot-go-here/(?P<middle>\w+)/$', empty_view, name='name-conflict'),
|
||||
re_path(r'^conflict-middle/(?P<middle>\w+)/$', empty_view, name='name-conflict'),
|
||||
re_path(r'^conflict-last/(?P<last>\w+)/$', empty_view, name='name-conflict'),
|
||||
# Two kwargs
|
||||
url(r'^conflict/(?P<another>\w+)/(?P<extra>\w+)/cannot-go-here/$', empty_view, name='name-conflict'),
|
||||
url(r'^conflict/(?P<extra>\w+)/(?P<another>\w+)/$', empty_view, name='name-conflict'),
|
||||
re_path(r'^conflict/(?P<another>\w+)/(?P<extra>\w+)/cannot-go-here/$', empty_view, name='name-conflict'),
|
||||
re_path(r'^conflict/(?P<extra>\w+)/(?P<another>\w+)/$', empty_view, name='name-conflict'),
|
||||
]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from django.conf.urls import include, url
|
||||
from django.urls import include, path, re_path
|
||||
|
||||
from . import views
|
||||
from .utils import URLObject
|
||||
|
@ -14,48 +14,48 @@ newappobj1 = URLObject('newapp')
|
|||
|
||||
app_name = 'namespace_urls'
|
||||
urlpatterns = [
|
||||
url(r'^normal/$', views.empty_view, name='normal-view'),
|
||||
url(r'^normal/(?P<arg1>[0-9]+)/(?P<arg2>[0-9]+)/$', views.empty_view, name='normal-view'),
|
||||
url(r'^resolver_match/$', views.pass_resolver_match_view, name='test-resolver-match'),
|
||||
path('normal/', views.empty_view, name='normal-view'),
|
||||
re_path(r'^normal/(?P<arg1>[0-9]+)/(?P<arg2>[0-9]+)/$', views.empty_view, name='normal-view'),
|
||||
path('resolver_match/', views.pass_resolver_match_view, name='test-resolver-match'),
|
||||
|
||||
url(r'^\+\\\$\*/$', views.empty_view, name='special-view'),
|
||||
re_path(r'^\+\\\$\*/$', views.empty_view, name='special-view'),
|
||||
|
||||
url(r'^mixed_args/([0-9]+)/(?P<arg2>[0-9]+)/$', views.empty_view, name='mixed-args'),
|
||||
url(r'^no_kwargs/([0-9]+)/([0-9]+)/$', views.empty_view, name='no-kwargs'),
|
||||
re_path(r'^mixed_args/([0-9]+)/(?P<arg2>[0-9]+)/$', views.empty_view, name='mixed-args'),
|
||||
re_path(r'^no_kwargs/([0-9]+)/([0-9]+)/$', views.empty_view, name='no-kwargs'),
|
||||
|
||||
url(r'^view_class/(?P<arg1>[0-9]+)/(?P<arg2>[0-9]+)/$', views.view_class_instance, name='view-class'),
|
||||
re_path(r'^view_class/(?P<arg1>[0-9]+)/(?P<arg2>[0-9]+)/$', views.view_class_instance, name='view-class'),
|
||||
|
||||
url(r'^unnamed/normal/(?P<arg1>[0-9]+)/(?P<arg2>[0-9]+)/$', views.empty_view),
|
||||
url(r'^unnamed/view_class/(?P<arg1>[0-9]+)/(?P<arg2>[0-9]+)/$', views.view_class_instance),
|
||||
re_path(r'^unnamed/normal/(?P<arg1>[0-9]+)/(?P<arg2>[0-9]+)/$', views.empty_view),
|
||||
re_path(r'^unnamed/view_class/(?P<arg1>[0-9]+)/(?P<arg2>[0-9]+)/$', views.view_class_instance),
|
||||
|
||||
url(r'^test1/', include(*testobj1.urls)),
|
||||
url(r'^test2/', include(*testobj2.urls)),
|
||||
url(r'^default/', include(*default_testobj.urls)),
|
||||
path('test1/', include(*testobj1.urls)),
|
||||
path('test2/', include(*testobj2.urls)),
|
||||
path('default/', include(*default_testobj.urls)),
|
||||
|
||||
url(r'^other1/', include(*otherobj1.urls)),
|
||||
url(r'^other[246]/', include(*otherobj2.urls)),
|
||||
path('other1/', include(*otherobj1.urls)),
|
||||
re_path(r'^other[246]/', include(*otherobj2.urls)),
|
||||
|
||||
url(r'^newapp1/', include(newappobj1.app_urls, 'new-ns1')),
|
||||
url(r'^new-default/', include(newappobj1.app_urls)),
|
||||
path('newapp1/', include(newappobj1.app_urls, 'new-ns1')),
|
||||
path('new-default/', include(newappobj1.app_urls)),
|
||||
|
||||
url(r'^app-included[135]/', include('urlpatterns_reverse.included_app_urls', namespace='app-ns1')),
|
||||
url(r'^app-included2/', include('urlpatterns_reverse.included_app_urls', namespace='app-ns2')),
|
||||
re_path(r'^app-included[135]/', include('urlpatterns_reverse.included_app_urls', namespace='app-ns1')),
|
||||
path('app-included2/', include('urlpatterns_reverse.included_app_urls', namespace='app-ns2')),
|
||||
|
||||
url(r'^ns-included[135]/', include('urlpatterns_reverse.included_namespace_urls', namespace='inc-ns1')),
|
||||
url(r'^ns-included2/', include('urlpatterns_reverse.included_namespace_urls', namespace='inc-ns2')),
|
||||
re_path(r'^ns-included[135]/', include('urlpatterns_reverse.included_namespace_urls', namespace='inc-ns1')),
|
||||
path('ns-included2/', include('urlpatterns_reverse.included_namespace_urls', namespace='inc-ns2')),
|
||||
|
||||
url(r'^app-included/', include('urlpatterns_reverse.included_namespace_urls', 'inc-app')),
|
||||
path('app-included/', include('urlpatterns_reverse.included_namespace_urls', 'inc-app')),
|
||||
|
||||
url(r'^included/', include('urlpatterns_reverse.included_namespace_urls')),
|
||||
url(
|
||||
path('included/', include('urlpatterns_reverse.included_namespace_urls')),
|
||||
re_path(
|
||||
r'^inc(?P<outer>[0-9]+)/', include(('urlpatterns_reverse.included_urls', 'included_urls'), namespace='inc-ns5')
|
||||
),
|
||||
url(r'^included/([0-9]+)/', include('urlpatterns_reverse.included_namespace_urls')),
|
||||
re_path(r'^included/([0-9]+)/', include('urlpatterns_reverse.included_namespace_urls')),
|
||||
|
||||
url(
|
||||
re_path(
|
||||
r'^ns-outer/(?P<outer>[0-9]+)/',
|
||||
include('urlpatterns_reverse.included_namespace_urls', namespace='inc-outer')
|
||||
),
|
||||
|
||||
url(r'^\+\\\$\*/', include('urlpatterns_reverse.namespace_urls', namespace='special')),
|
||||
re_path(r'^\+\\\$\*/', include('urlpatterns_reverse.namespace_urls', namespace='special')),
|
||||
]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from django.conf.urls import include, url
|
||||
from django.urls import include, path
|
||||
from django.views import View
|
||||
|
||||
|
||||
|
@ -15,11 +15,11 @@ class View3(View):
|
|||
|
||||
|
||||
nested = ([
|
||||
url(r'^view1/$', view1, name='view1'),
|
||||
url(r'^view3/$', View3.as_view(), name='view3'),
|
||||
path('view1/', view1, name='view1'),
|
||||
path('view3/', View3.as_view(), name='view3'),
|
||||
], 'backend')
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^some/path/', include(nested, namespace='nested')),
|
||||
url(r'^view2/$', view2, name='view2'),
|
||||
path('some/path/', include(nested, namespace='nested')),
|
||||
path('view2/', view2, name='view2'),
|
||||
]
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
from django.conf.urls import url
|
||||
from django.urls import path
|
||||
|
||||
from .views import LazyRedirectView, empty_view, login_required_view
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^redirected_to/$', empty_view, name='named-lazy-url-redirected-to'),
|
||||
url(r'^login/$', empty_view, name='some-login-page'),
|
||||
url(r'^login_required_view/$', login_required_view),
|
||||
url(r'^redirect/$', LazyRedirectView.as_view()),
|
||||
path('redirected_to/', empty_view, name='named-lazy-url-redirected-to'),
|
||||
path('login/', empty_view, name='some-login-page'),
|
||||
path('login_required_view/', login_required_view),
|
||||
path('redirect/', LazyRedirectView.as_view()),
|
||||
]
|
||||
|
|
|
@ -7,7 +7,6 @@ import threading
|
|||
from admin_scripts.tests import AdminScriptTestCase
|
||||
|
||||
from django.conf import settings
|
||||
from django.conf.urls import include, url
|
||||
from django.contrib.auth.models import User
|
||||
from django.core.exceptions import ImproperlyConfigured, ViewDoesNotExist
|
||||
from django.http import (
|
||||
|
@ -18,7 +17,8 @@ from django.test import SimpleTestCase, TestCase, override_settings
|
|||
from django.test.utils import override_script_prefix
|
||||
from django.urls import (
|
||||
NoReverseMatch, Resolver404, ResolverMatch, URLPattern, URLResolver,
|
||||
get_callable, get_resolver, get_urlconf, resolve, reverse, reverse_lazy,
|
||||
get_callable, get_resolver, get_urlconf, include, path, re_path, resolve,
|
||||
reverse, reverse_lazy,
|
||||
)
|
||||
from django.urls.resolvers import RegexPattern
|
||||
|
||||
|
@ -401,7 +401,7 @@ class ResolverTests(SimpleTestCase):
|
|||
|
||||
def test_resolver_reverse_conflict(self):
|
||||
"""
|
||||
url() name arguments don't need to be unique. The last registered
|
||||
URL pattern name arguments don't need to be unique. The last registered
|
||||
pattern takes precedence for conflicting names.
|
||||
"""
|
||||
resolver = get_resolver('urlpatterns_reverse.named_urls_conflict')
|
||||
|
@ -411,7 +411,7 @@ class ResolverTests(SimpleTestCase):
|
|||
('name-conflict', (), {}, 'conflict/'),
|
||||
# With an arg, the last URL in urlpatterns has precedence.
|
||||
('name-conflict', ('arg',), {}, 'conflict-last/arg/'),
|
||||
# With a kwarg, other url()s can be reversed.
|
||||
# With a kwarg, other URL patterns can be reversed.
|
||||
('name-conflict', (), {'first': 'arg'}, 'conflict-first/arg/'),
|
||||
('name-conflict', (), {'middle': 'arg'}, 'conflict-middle/arg/'),
|
||||
('name-conflict', (), {'last': 'arg'}, 'conflict-last/arg/'),
|
||||
|
@ -430,10 +430,10 @@ class ResolverTests(SimpleTestCase):
|
|||
TypeError from occurring later (#10834).
|
||||
"""
|
||||
test_urls = ['', 'a', '\\', '.']
|
||||
for path in test_urls:
|
||||
with self.subTest(path=path):
|
||||
for path_ in test_urls:
|
||||
with self.subTest(path=path_):
|
||||
with self.assertRaises(Resolver404):
|
||||
resolve(path)
|
||||
resolve(path_)
|
||||
|
||||
def test_404_tried_urls_have_names(self):
|
||||
"""
|
||||
|
@ -1094,15 +1094,15 @@ class NoRootUrlConfTests(SimpleTestCase):
|
|||
class ResolverMatchTests(SimpleTestCase):
|
||||
|
||||
def test_urlpattern_resolve(self):
|
||||
for path, url_name, app_name, namespace, view_name, func, args, kwargs in resolve_test_data:
|
||||
with self.subTest(path=path):
|
||||
for path_, url_name, app_name, namespace, view_name, func, args, kwargs in resolve_test_data:
|
||||
with self.subTest(path=path_):
|
||||
# Legacy support for extracting "function, args, kwargs".
|
||||
match_func, match_args, match_kwargs = resolve(path)
|
||||
match_func, match_args, match_kwargs = resolve(path_)
|
||||
self.assertEqual(match_func, func)
|
||||
self.assertEqual(match_args, args)
|
||||
self.assertEqual(match_kwargs, kwargs)
|
||||
# ResolverMatch capabilities.
|
||||
match = resolve(path)
|
||||
match = resolve(path_)
|
||||
self.assertEqual(match.__class__, ResolverMatch)
|
||||
self.assertEqual(match.url_name, url_name)
|
||||
self.assertEqual(match.app_name, app_name)
|
||||
|
@ -1140,7 +1140,7 @@ class ErroneousViewTests(SimpleTestCase):
|
|||
def test_noncallable_view(self):
|
||||
# View is not a callable (explicit import; arbitrary Python object)
|
||||
with self.assertRaisesMessage(TypeError, 'view must be a callable'):
|
||||
url(r'uncallable-object/$', views.uncallable)
|
||||
path('uncallable-object/', views.uncallable)
|
||||
|
||||
def test_invalid_regex(self):
|
||||
# Regex contains an error (refs #6170)
|
||||
|
@ -1194,9 +1194,9 @@ class ViewLoadingTests(SimpleTestCase):
|
|||
|
||||
class IncludeTests(SimpleTestCase):
|
||||
url_patterns = [
|
||||
url(r'^inner/$', views.empty_view, name='urlobject-view'),
|
||||
url(r'^inner/(?P<arg1>[0-9]+)/(?P<arg2>[0-9]+)/$', views.empty_view, name='urlobject-view'),
|
||||
url(r'^inner/\+\\\$\*/$', views.empty_view, name='urlobject-special-view'),
|
||||
path('inner/', views.empty_view, name='urlobject-view'),
|
||||
re_path(r'^inner/(?P<arg1>[0-9]+)/(?P<arg2>[0-9]+)/$', views.empty_view, name='urlobject-view'),
|
||||
re_path(r'^inner/\+\\\$\*/$', views.empty_view, name='urlobject-special-view'),
|
||||
]
|
||||
app_urls = URLObject('inc-app')
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from django.conf.urls import url
|
||||
from django.http import HttpResponse
|
||||
from django.template import Context, Template
|
||||
from django.urls import path
|
||||
|
||||
|
||||
def inner_view(request):
|
||||
|
@ -10,5 +10,5 @@ def inner_view(request):
|
|||
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^second_test/$', inner_view, name='inner'),
|
||||
path('second_test/', inner_view, name='inner'),
|
||||
]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
from django.conf.urls import include, url
|
||||
from django.urls import include, path
|
||||
|
||||
from . import urlconf_inner
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^test/me/$', urlconf_inner.inner_view, name='outer'),
|
||||
url(r'^inner_urlconf/', include(urlconf_inner.__name__))
|
||||
path('test/me/', urlconf_inner.inner_view, name='outer'),
|
||||
path('inner_urlconf/', include(urlconf_inner.__name__))
|
||||
]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from django.conf.urls import include, url
|
||||
from django.urls import include, path, re_path
|
||||
|
||||
from .views import (
|
||||
absolute_kwargs_view, defaults_view, empty_view, empty_view_nested_partial,
|
||||
|
@ -6,74 +6,74 @@ from .views import (
|
|||
)
|
||||
|
||||
other_patterns = [
|
||||
url(r'non_path_include/$', empty_view, name='non_path_include'),
|
||||
url(r'nested_path/$', nested_view),
|
||||
path('non_path_include/', empty_view, name='non_path_include'),
|
||||
path('nested_path/', nested_view),
|
||||
]
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^places/([0-9]+)/$', empty_view, name='places'),
|
||||
url(r'^places?/$', empty_view, name="places?"),
|
||||
url(r'^places+/$', empty_view, name="places+"),
|
||||
url(r'^places*/$', empty_view, name="places*"),
|
||||
url(r'^(?:places/)?$', empty_view, name="places2?"),
|
||||
url(r'^(?:places/)+$', empty_view, name="places2+"),
|
||||
url(r'^(?:places/)*$', empty_view, name="places2*"),
|
||||
url(r'^places/([0-9]+|[a-z_]+)/', empty_view, name="places3"),
|
||||
url(r'^places/(?P<id>[0-9]+)/$', empty_view, name="places4"),
|
||||
url(r'^people/(?P<name>\w+)/$', empty_view, name="people"),
|
||||
url(r'^people/(?:name/)', empty_view, name="people2"),
|
||||
url(r'^people/(?:name/(\w+)/)?', empty_view, name="people2a"),
|
||||
url(r'^people/(?P<name>\w+)-(?P=name)/$', empty_view, name="people_backref"),
|
||||
url(r'^optional/(?P<name>.*)/(?:.+/)?', empty_view, name="optional"),
|
||||
url(r'^optional/(?P<arg1>\d+)/(?:(?P<arg2>\d+)/)?', absolute_kwargs_view, name="named_optional"),
|
||||
url(r'^optional/(?P<arg1>\d+)/(?:(?P<arg2>\d+)/)?$', absolute_kwargs_view, name="named_optional_terminated"),
|
||||
url(r'^nested/noncapture/(?:(?P<p>\w+))$', empty_view, name='nested-noncapture'),
|
||||
url(r'^nested/capture/((\w+)/)?$', empty_view, name='nested-capture'),
|
||||
url(r'^nested/capture/mixed/((?P<p>\w+))$', empty_view, name='nested-mixedcapture'),
|
||||
url(r'^nested/capture/named/(?P<outer>(?P<inner>\w+)/)?$', empty_view, name='nested-namedcapture'),
|
||||
url(r'^hardcoded/$', empty_view, name="hardcoded"),
|
||||
url(r'^hardcoded/doc\.pdf$', empty_view, name="hardcoded2"),
|
||||
url(r'^people/(?P<state>\w\w)/(?P<name>\w+)/$', empty_view, name="people3"),
|
||||
url(r'^people/(?P<state>\w\w)/(?P<name>[0-9])/$', empty_view, name="people4"),
|
||||
url(r'^people/((?P<state>\w\w)/test)?/(\w+)/$', empty_view, name="people6"),
|
||||
url(r'^character_set/[abcdef0-9]/$', empty_view, name="range"),
|
||||
url(r'^character_set/[\w]/$', empty_view, name="range2"),
|
||||
url(r'^price/\$([0-9]+)/$', empty_view, name="price"),
|
||||
url(r'^price/[$]([0-9]+)/$', empty_view, name="price2"),
|
||||
url(r'^price/[\$]([0-9]+)/$', empty_view, name="price3"),
|
||||
url(r'^product/(?P<product>\w+)\+\(\$(?P<price>[0-9]+(\.[0-9]+)?)\)/$', empty_view, name="product"),
|
||||
url(r'^headlines/(?P<year>[0-9]+)\.(?P<month>[0-9]+)\.(?P<day>[0-9]+)/$', empty_view, name="headlines"),
|
||||
url(r'^windows_path/(?P<drive_name>[A-Z]):\\(?P<path>.+)/$', empty_view, name="windows"),
|
||||
url(r'^special_chars/(?P<chars>.+)/$', empty_view, name="special"),
|
||||
url(r'^(?P<name>.+)/[0-9]+/$', empty_view, name="mixed"),
|
||||
url(r'^repeats/a{1,2}/$', empty_view, name="repeats"),
|
||||
url(r'^repeats/a{2,4}/$', empty_view, name="repeats2"),
|
||||
url(r'^repeats/a{2}/$', empty_view, name="repeats3"),
|
||||
url(r'^test/1/?', empty_view, name="test"),
|
||||
url(r'^outer/(?P<outer>[0-9]+)/', include('urlpatterns_reverse.included_urls')),
|
||||
url(r'^outer-no-kwargs/([0-9]+)/', include('urlpatterns_reverse.included_no_kwargs_urls')),
|
||||
url('', include('urlpatterns_reverse.extra_urls')),
|
||||
url(r'^lookahead-/(?!not-a-city)(?P<city>[^/]+)/$', empty_view, name='lookahead-negative'),
|
||||
url(r'^lookahead\+/(?=a-city)(?P<city>[^/]+)/$', empty_view, name='lookahead-positive'),
|
||||
url(r'^lookbehind-/(?P<city>[^/]+)(?<!not-a-city)/$', empty_view, name='lookbehind-negative'),
|
||||
url(r'^lookbehind\+/(?P<city>[^/]+)(?<=a-city)/$', empty_view, name='lookbehind-positive'),
|
||||
re_path(r'^places/([0-9]+)/$', empty_view, name='places'),
|
||||
re_path(r'^places?/$', empty_view, name='places?'),
|
||||
re_path(r'^places+/$', empty_view, name='places+'),
|
||||
re_path(r'^places*/$', empty_view, name='places*'),
|
||||
re_path(r'^(?:places/)?$', empty_view, name='places2?'),
|
||||
re_path(r'^(?:places/)+$', empty_view, name='places2+'),
|
||||
re_path(r'^(?:places/)*$', empty_view, name='places2*'),
|
||||
re_path(r'^places/([0-9]+|[a-z_]+)/', empty_view, name='places3'),
|
||||
re_path(r'^places/(?P<id>[0-9]+)/$', empty_view, name='places4'),
|
||||
re_path(r'^people/(?P<name>\w+)/$', empty_view, name='people'),
|
||||
re_path(r'^people/(?:name/)$', empty_view, name='people2'),
|
||||
re_path(r'^people/(?:name/(\w+)/)?$', empty_view, name='people2a'),
|
||||
re_path(r'^people/(?P<name>\w+)-(?P=name)/$', empty_view, name='people_backref'),
|
||||
re_path(r'^optional/(?P<name>.*)/(?:.+/)?', empty_view, name='optional'),
|
||||
re_path(r'^optional/(?P<arg1>\d+)/(?:(?P<arg2>\d+)/)?', absolute_kwargs_view, name='named_optional'),
|
||||
re_path(r'^optional/(?P<arg1>\d+)/(?:(?P<arg2>\d+)/)?$', absolute_kwargs_view, name='named_optional_terminated'),
|
||||
re_path(r'^nested/noncapture/(?:(?P<p>\w+))$', empty_view, name='nested-noncapture'),
|
||||
re_path(r'^nested/capture/((\w+)/)?$', empty_view, name='nested-capture'),
|
||||
re_path(r'^nested/capture/mixed/((?P<p>\w+))$', empty_view, name='nested-mixedcapture'),
|
||||
re_path(r'^nested/capture/named/(?P<outer>(?P<inner>\w+)/)?$', empty_view, name='nested-namedcapture'),
|
||||
re_path(r'^hardcoded/$', empty_view, name='hardcoded'),
|
||||
re_path(r'^hardcoded/doc\.pdf$', empty_view, name='hardcoded2'),
|
||||
re_path(r'^people/(?P<state>\w\w)/(?P<name>\w+)/$', empty_view, name='people3'),
|
||||
re_path(r'^people/(?P<state>\w\w)/(?P<name>[0-9])/$', empty_view, name='people4'),
|
||||
re_path(r'^people/((?P<state>\w\w)/test)?/(\w+)/$', empty_view, name='people6'),
|
||||
re_path(r'^character_set/[abcdef0-9]/$', empty_view, name='range'),
|
||||
re_path(r'^character_set/[\w]/$', empty_view, name='range2'),
|
||||
re_path(r'^price/\$([0-9]+)/$', empty_view, name='price'),
|
||||
re_path(r'^price/[$]([0-9]+)/$', empty_view, name='price2'),
|
||||
re_path(r'^price/[\$]([0-9]+)/$', empty_view, name='price3'),
|
||||
re_path(r'^product/(?P<product>\w+)\+\(\$(?P<price>[0-9]+(\.[0-9]+)?)\)/$', empty_view, name='product'),
|
||||
re_path(r'^headlines/(?P<year>[0-9]+)\.(?P<month>[0-9]+)\.(?P<day>[0-9]+)/$', empty_view, name='headlines'),
|
||||
re_path(r'^windows_path/(?P<drive_name>[A-Z]):\\(?P<path>.+)/$', empty_view, name='windows'),
|
||||
re_path(r'^special_chars/(?P<chars>.+)/$', empty_view, name='special'),
|
||||
re_path(r'^(?P<name>.+)/[0-9]+/$', empty_view, name='mixed'),
|
||||
re_path(r'^repeats/a{1,2}/$', empty_view, name='repeats'),
|
||||
re_path(r'^repeats/a{2,4}/$', empty_view, name='repeats2'),
|
||||
re_path(r'^repeats/a{2}/$', empty_view, name='repeats3'),
|
||||
re_path(r'^test/1/?', empty_view, name='test'),
|
||||
re_path(r'^outer/(?P<outer>[0-9]+)/', include('urlpatterns_reverse.included_urls')),
|
||||
re_path(r'^outer-no-kwargs/([0-9]+)/', include('urlpatterns_reverse.included_no_kwargs_urls')),
|
||||
re_path('', include('urlpatterns_reverse.extra_urls')),
|
||||
re_path(r'^lookahead-/(?!not-a-city)(?P<city>[^/]+)/$', empty_view, name='lookahead-negative'),
|
||||
re_path(r'^lookahead\+/(?=a-city)(?P<city>[^/]+)/$', empty_view, name='lookahead-positive'),
|
||||
re_path(r'^lookbehind-/(?P<city>[^/]+)(?<!not-a-city)/$', empty_view, name='lookbehind-negative'),
|
||||
re_path(r'^lookbehind\+/(?P<city>[^/]+)(?<=a-city)/$', empty_view, name='lookbehind-positive'),
|
||||
|
||||
# Partials should be fine.
|
||||
url(r'^partial/', empty_view_partial, name="partial"),
|
||||
url(r'^partial_nested/', empty_view_nested_partial, name="partial_nested"),
|
||||
url(r'^partial_wrapped/', empty_view_wrapped, name="partial_wrapped"),
|
||||
path('partial/', empty_view_partial, name='partial'),
|
||||
path('partial_nested/', empty_view_nested_partial, name='partial_nested'),
|
||||
path('partial_wrapped/', empty_view_wrapped, name='partial_wrapped'),
|
||||
|
||||
# This is non-reversible, but we shouldn't blow up when parsing it.
|
||||
url(r'^(?:foo|bar)(\w+)/$', empty_view, name="disjunction"),
|
||||
re_path(r'^(?:foo|bar)(\w+)/$', empty_view, name='disjunction'),
|
||||
|
||||
url(r'absolute_arg_view/$', absolute_kwargs_view),
|
||||
path('absolute_arg_view/', absolute_kwargs_view),
|
||||
|
||||
# Tests for #13154. Mixed syntax to test both ways of defining URLs.
|
||||
url(r'defaults_view1/(?P<arg1>[0-9]+)/', defaults_view, {'arg2': 1}, name='defaults'),
|
||||
url(r'defaults_view2/(?P<arg1>[0-9]+)/', defaults_view, {'arg2': 2}, 'defaults'),
|
||||
re_path(r'^defaults_view1/(?P<arg1>[0-9]+)/$', defaults_view, {'arg2': 1}, name='defaults'),
|
||||
re_path(r'^defaults_view2/(?P<arg1>[0-9]+)/$', defaults_view, {'arg2': 2}, 'defaults'),
|
||||
|
||||
url('^includes/', include(other_patterns)),
|
||||
path('includes/', include(other_patterns)),
|
||||
|
||||
# Security tests
|
||||
url('(.+)/security/$', empty_view, name='security'),
|
||||
re_path('(.+)/security/$', empty_view, name='security'),
|
||||
]
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
# A URLconf that doesn't define any handlerXXX.
|
||||
from django.conf.urls import url
|
||||
from django.urls import path
|
||||
|
||||
from .views import bad_view, empty_view
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^test_view/$', empty_view, name="test_view"),
|
||||
url(r'^bad_view/$', bad_view, name="bad_view"),
|
||||
path('test_view/', empty_view, name="test_view"),
|
||||
path('bad_view/', bad_view, name="bad_view"),
|
||||
]
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
from django.conf.urls import url
|
||||
from django.urls import path, re_path
|
||||
|
||||
from . import views
|
||||
|
||||
|
||||
class URLObject:
|
||||
urlpatterns = [
|
||||
url(r'^inner/$', views.empty_view, name='urlobject-view'),
|
||||
url(r'^inner/(?P<arg1>[0-9]+)/(?P<arg2>[0-9]+)/$', views.empty_view, name='urlobject-view'),
|
||||
url(r'^inner/\+\\\$\*/$', views.empty_view, name='urlobject-special-view'),
|
||||
path('inner/', views.empty_view, name='urlobject-view'),
|
||||
re_path(r'^inner/(?P<arg1>[0-9]+)/(?P<arg2>[0-9]+)/$', views.empty_view, name='urlobject-view'),
|
||||
re_path(r'^inner/\+\\\$\*/$', views.empty_view, name='urlobject-special-view'),
|
||||
]
|
||||
|
||||
def __init__(self, app_name, namespace=None):
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from django.conf.urls import url
|
||||
from django.urls import path
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^some/url/$', lambda req:req, name='some_url'),
|
||||
path('some/url/', lambda req:req, name='some_url'),
|
||||
]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from django.conf.urls import url
|
||||
from django.contrib import admin
|
||||
from django.urls import path
|
||||
|
||||
urlpatterns = [
|
||||
# This is the same as in the default project template
|
||||
url(r'^admin/', admin.site.urls),
|
||||
path('admin/', admin.site.urls),
|
||||
]
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from django.conf.urls import url
|
||||
from django.contrib.auth import views as auth_views
|
||||
from django.urls import path
|
||||
from django.views.generic import RedirectView
|
||||
|
||||
from . import views
|
||||
|
@ -25,22 +25,20 @@ numeric_days_info_dict = dict(date_based_info_dict, day_format='%d')
|
|||
date_based_datefield_info_dict = dict(date_based_info_dict, queryset=DateArticle.objects.all())
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^accounts/login/$', auth_views.LoginView.as_view(template_name='login.html')),
|
||||
url(r'^accounts/logout/$', auth_views.LogoutView.as_view()),
|
||||
path('accounts/login/', auth_views.LoginView.as_view(template_name='login.html')),
|
||||
path('accounts/logout/', auth_views.LogoutView.as_view()),
|
||||
|
||||
# Special URLs for particular regression cases.
|
||||
url('^中文/target/$', views.index_page),
|
||||
path('中文/target/', views.index_page),
|
||||
]
|
||||
|
||||
# redirects, both temporary and permanent, with non-ASCII targets
|
||||
urlpatterns += [
|
||||
url('^nonascii_redirect/$', RedirectView.as_view(
|
||||
url='/中文/target/', permanent=False)),
|
||||
url('^permanent_nonascii_redirect/$', RedirectView.as_view(
|
||||
url='/中文/target/', permanent=True)),
|
||||
path('nonascii_redirect/', RedirectView.as_view(url='/中文/target/', permanent=False)),
|
||||
path('permanent_nonascii_redirect/', RedirectView.as_view(url='/中文/target/', permanent=True)),
|
||||
]
|
||||
|
||||
# json response
|
||||
urlpatterns += [
|
||||
url(r'^json/response/$', views.json_response_view),
|
||||
path('json/response/', views.json_response_view),
|
||||
]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from django.conf.urls import url
|
||||
from django.urls import path
|
||||
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^index/$', views.index_page, name='index'),
|
||||
path('index/', views.index_page, name='index'),
|
||||
]
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue