mirror of
https://github.com/wagtail/wagtail.git
synced 2024-11-29 17:36:49 +01:00
depriciate url() for alias re_path()
This commit is contained in:
parent
cb75effd11
commit
cb8fe063bb
@ -82,7 +82,7 @@ This feature is enabled through the project's root URL configuration. Just put t
|
||||
|
||||
# mysite/urls.py
|
||||
|
||||
from django.conf.urls import include, url
|
||||
from django.conf.urls import include, re_path
|
||||
from django.conf.urls.i18n import i18n_patterns
|
||||
from django.conf import settings
|
||||
from django.contrib import admin
|
||||
@ -93,21 +93,26 @@ This feature is enabled through the project's root URL configuration. Just put t
|
||||
from search import views as search_views
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^django-admin/', include(admin.site.urls)),
|
||||
re_path(r'^django-admin/', include(admin.site.urls)),
|
||||
|
||||
url(r'^admin/', include(wagtailadmin_urls)),
|
||||
url(r'^documents/', include(wagtaildocs_urls)),
|
||||
re_path(r'^admin/', include(wagtailadmin_urls)),
|
||||
re_path(r'^documents/', include(wagtaildocs_urls)),
|
||||
]
|
||||
|
||||
|
||||
urlpatterns += i18n_patterns(
|
||||
# These URLs will have /<language_code>/ appended to the beginning
|
||||
|
||||
url(r'^search/$', search_views.search, name='search'),
|
||||
re_path(r'^search/$', search_views.search, name='search'),
|
||||
|
||||
url(r'', include(wagtail_urls)),
|
||||
re_path(r'', include(wagtail_urls)),
|
||||
)
|
||||
|
||||
.. important::
|
||||
|
||||
The example above assumes you are using Django version 2.0 or later. If you are using a Django version earlier than 2.0, you should rename all occurrences of re_path() to url(). For example: ``from django.conf.urls import include, url`` instead of ``from django.conf.urls import include, re_path`` and ``url(r'^django-admin/', include(admin.site.urls)),`` instead of ``re_path(r'^django-admin/', include(admin.site.urls)),``.
|
||||
(`read more <https://docs.djangoproject.com/en/2.1/ref/urls/#url>`_).
|
||||
|
||||
You can implement switching between languages by changing the part at the beginning of the URL. As each language has its own URL, it also works well with just about any caching setup.
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user