mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Updated test URL patterns to use path() and re_path().
This commit is contained in:
@@ -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'),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user