django4: fix urls deprecation warnings (#68573)

This commit is contained in:
Agate 2022-08-31 09:32:39 +02:00
parent e1f969f813
commit d8786aae95
5 changed files with 52 additions and 52 deletions

View File

@ -15,7 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from django.apps import apps
from django.conf.urls import include, url
from django.urls import include, re_path
def register_urls(urlpatterns):
@ -25,9 +25,9 @@ def register_urls(urlpatterns):
if hasattr(app, 'get_before_urls'):
urls = app.get_before_urls()
if urls:
pre_urls.append(url('^', include(urls)))
pre_urls.append(re_path('^', include(urls)))
if hasattr(app, 'get_after_urls'):
urls = app.get_after_urls()
if urls:
post_urls.append(url('^', include(urls)))
post_urls.append(re_path('^', include(urls)))
return pre_urls + urlpatterns + post_urls

View File

@ -14,10 +14,10 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from django.conf.urls import url
from django.urls import path
from . import views
urlpatterns = [
url(r'^ajax/counter/zone/$', views.zone, name='counter-zone'),
path('ajax/counter/zone/', views.zone, name='counter-zone'),
]

View File

@ -14,17 +14,17 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from django.conf.urls import url
from django.urls import path, re_path
from .views import edit_note, feeder, mail_count, mail_response, note, qualification_save, reject, viewer
urlpatterns = [
url(r'^mail/viewer/$', viewer, name='mail-viewer'),
url(r'^mail/feeder/$', feeder, name='mail-feeder'),
url(r'^ajax/mail/reject$', reject, name='mail-reject'),
url(r'^ajax/qualification-mail-save$', qualification_save, name='qualif-mail-save'),
url(r'^ajax/mail/edit-note/$', edit_note, name='mail-edit-note'),
url(r'^ajax/mail/note/(?P<pk>\w+)$', note, name='mail-note'),
url(r'^ajax/count/mail/$', mail_count, name='mail-count'),
url(r'^api/mail/response/$', mail_response, name='mail-api-response'),
path('mail/viewer/', viewer, name='mail-viewer'),
path('mail/feeder/', feeder, name='mail-feeder'),
path('ajax/mail/reject', reject, name='mail-reject'),
path('ajax/qualification-mail-save', qualification_save, name='qualif-mail-save'),
path('ajax/mail/edit-note/', edit_note, name='mail-edit-note'),
re_path(r'^ajax/mail/note/(?P<pk>\w+)$', note, name='mail-note'),
path('ajax/count/mail/', mail_count, name='mail-count'),
path('api/mail/response/', mail_response, name='mail-api-response'),
]

View File

@ -14,15 +14,15 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from django.conf.urls import url
from django.urls import path, re_path
from . import views
urlpatterns = [
url(r'^ajax/phone/zone/$', views.zone, name='phone-zone'),
url(r'^api/phone/call-event/$', views.call_event, name='phone-call-event'),
url(r'^api/phone/active-call/(?P<pk>\w+)/$', views.active_call, name='phone-active-call'),
url(r'^api/phone/current-calls/$', views.current_calls, name='phone-current-calls'),
url(r'^api/phone/take-line/$', views.take_line, name='phone-take-line'),
url(r'^api/phone/release-line/$', views.release_line, name='phone-release-line'),
path('ajax/phone/zone/', views.zone, name='phone-zone'),
path('api/phone/call-event/', views.call_event, name='phone-call-event'),
re_path(r'^api/phone/active-call/(?P<pk>\w+)/$', views.active_call, name='phone-active-call'),
path('api/phone/current-calls/', views.current_calls, name='phone-current-calls'),
path('api/phone/take-line/', views.take_line, name='phone-take-line'),
path('api/phone/release-line/', views.release_line, name='phone-release-line'),
]

View File

@ -16,10 +16,10 @@
from ckeditor import views as ckeditor_views
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.urls import include, path, re_path
from django.views.decorators.cache import never_cache
import welco.contacts.views
@ -30,53 +30,53 @@ from . import apps
from .kb.views import kb_manager_required
urlpatterns = [
url(r'^$', welco.views.home, name='home'),
url(r'^mail/$', welco.views.home_mail, name='home-mail'),
url(r'^phone/$', welco.views.home_phone, name='home-phone'),
url(r'^counter/$', welco.views.home_counter, name='home-counter'),
url(r'^', include('welco.sources.phone.urls')),
url(r'^', include('welco.sources.counter.urls')),
url(r'^ajax/qualification$', welco.views.qualification, name='qualif-zone'),
url(
path('', welco.views.home, name='home'),
path('mail/', welco.views.home_mail, name='home-mail'),
path('phone/', welco.views.home_phone, name='home-phone'),
path('counter/', welco.views.home_counter, name='home-counter'),
re_path(r'^', include('welco.sources.phone.urls')),
re_path(r'^', include('welco.sources.counter.urls')),
path('ajax/qualification', welco.views.qualification, name='qualif-zone'),
re_path(
r'^ajax/remove-association/(?P<pk>\w+)$',
welco.views.remove_association,
name='ajax-remove-association',
),
url(r'^ajax/create-formdata/(?P<pk>\w+)$', welco.views.create_formdata, name='ajax-create-formdata'),
url(r'^ajax/kb$', welco.kb.views.zone, name='kb-zone'),
url(r'^kb/$', welco.kb.views.page_list, name='kb-home'),
url(r'^kb/add/$', welco.kb.views.page_add, name='kb-page-add'),
url(r'^kb/search/$', welco.kb.views.page_search, name='kb-page-search'),
url(r'^kb/search/json/$', welco.kb.views.page_search_json, name='kb-page-search-json'),
url(r'^kb/(?P<slug>[\w-]+)/$', welco.kb.views.page_detail, name='kb-page-view'),
url(r'^ajax/kb/(?P<slug>[\w-]+)/$', welco.kb.views.page_detail_fragment, name='kb-page-fragment'),
url(r'^kb/(?P<slug>[\w-]+)/edit$', welco.kb.views.page_edit, name='kb-page-edit'),
url(r'^kb/(?P<slug>[\w-]+)/delete$', welco.kb.views.page_delete, name='kb-page-delete'),
url(r'^ajax/contacts$', welco.contacts.views.zone, name='contacts-zone'),
url(r'^contacts/search/json/$', welco.contacts.views.search_json, name='contacts-search-json'),
url(
re_path(r'^ajax/create-formdata/(?P<pk>\w+)$', welco.views.create_formdata, name='ajax-create-formdata'),
path('ajax/kb', welco.kb.views.zone, name='kb-zone'),
path('kb/', welco.kb.views.page_list, name='kb-home'),
path('kb/add/', welco.kb.views.page_add, name='kb-page-add'),
path('kb/search/', welco.kb.views.page_search, name='kb-page-search'),
path('kb/search/json/', welco.kb.views.page_search_json, name='kb-page-search-json'),
re_path(r'^kb/(?P<slug>[\w-]+)/$', welco.kb.views.page_detail, name='kb-page-view'),
re_path(r'^ajax/kb/(?P<slug>[\w-]+)/$', welco.kb.views.page_detail_fragment, name='kb-page-fragment'),
re_path(r'^kb/(?P<slug>[\w-]+)/edit$', welco.kb.views.page_edit, name='kb-page-edit'),
re_path(r'^kb/(?P<slug>[\w-]+)/delete$', welco.kb.views.page_delete, name='kb-page-delete'),
path('ajax/contacts', welco.contacts.views.zone, name='contacts-zone'),
path('contacts/search/json/', welco.contacts.views.search_json, name='contacts-search-json'),
re_path(
r'^ajax/contacts/(?P<slug>[\w-]+)/$',
welco.contacts.views.contact_detail_fragment,
name='contact-page-fragment',
),
url(r'^contacts/add/$', welco.contacts.views.contact_add, name='contacts-add'),
url(
path('contacts/add/', welco.contacts.views.contact_add, name='contacts-add'),
re_path(
r'^ajax/summary/(?P<source_type>\w+)/(?P<source_pk>\w+)/$',
welco.views.wcs_summary,
name='wcs-summary',
),
url(r'^admin/', admin.site.urls),
url(r'^logout/$', welco.views.logout, name='auth_logout'),
url(r'^login/$', welco.views.login, name='auth_login'),
url(r'^menu.json$', welco.views.menu_json, name='menu_json'),
url(r'^ckeditor/upload/', kb_manager_required(ckeditor_views.upload), name='ckeditor_upload'),
url(
re_path(r'^admin/', admin.site.urls),
path('logout/', welco.views.logout, name='auth_logout'),
path('login/', welco.views.login, name='auth_login'),
re_path(r'^menu.json$', welco.views.menu_json, name='menu_json'),
re_path(r'^ckeditor/upload/', kb_manager_required(ckeditor_views.upload), name='ckeditor_upload'),
re_path(
r'^ckeditor/browse/', never_cache(kb_manager_required(ckeditor_views.browse)), name='ckeditor_browse'
),
]
if 'mellon' in settings.INSTALLED_APPS:
urlpatterns.append(url(r'^accounts/mellon/', include('mellon.urls')))
urlpatterns.append(re_path(r'^accounts/mellon/', include('mellon.urls')))
# static and media files
urlpatterns += staticfiles_urlpatterns()