From 23f13e68c12dd27041f99320bdeeb8d268449ea7 Mon Sep 17 00:00:00 2001 From: irtazaakram Date: Fri, 15 Sep 2023 14:03:07 +0500 Subject: [PATCH] fix: codemod changes --- designer/apps/api/urls.py | 4 ++-- designer/urls.py | 28 ++++++++++++++-------------- tox.ini | 2 +- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/designer/apps/api/urls.py b/designer/apps/api/urls.py index cf718fc2..05355c12 100644 --- a/designer/apps/api/urls.py +++ b/designer/apps/api/urls.py @@ -4,11 +4,11 @@ All API URLs should be versioned, so urlpatterns should only contain namespaces for the active versions of the API. """ -from django.urls import re_path, include +from django.urls import include, path app_name = 'api' urlpatterns = [ - re_path(r'^v1/', include(('designer.apps.api.v1.urls', 'v1'))), + path('v1/', include(('designer.apps.api.v1.urls', 'v1'))), ] diff --git a/designer/urls.py b/designer/urls.py index bde543ee..d532824c 100644 --- a/designer/urls.py +++ b/designer/urls.py @@ -17,7 +17,7 @@ from auth_backends.urls import oauth2_urlpatterns from django.conf import settings -from django.urls import re_path, include +from django.urls import include, path from django.conf.urls.static import static from django.contrib import admin from django.views.generic import RedirectView @@ -42,21 +42,21 @@ ) urlpatterns = oauth2_urlpatterns + [ - re_path(r'^api/', include('designer.apps.api.urls')), - re_path(r'^api-docs/$', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'), + path('api/', include('designer.apps.api.urls')), + path('api-docs/', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'), # Use the same auth views for all logins, including those originating from the browseable API. - re_path(r'^api-auth/', include(oauth2_urlpatterns)), - re_path(r'^auto_auth/$', core_views.AutoAuth.as_view(), name='auto_auth'), - re_path(r'^health/$', core_views.health, name='health'), - re_path(r'^documents/', include(wagtaildocs_urls)), - re_path(r'^pages/', include(wagtail_urls)), - re_path(r'^cms/login/$', core_views.wagtail_admin_access_check), - re_path(r'^cms/logout/$', RedirectView.as_view(url='/logout/')), - re_path(r'^cms/sites/new/$', SiteCreationView.as_view(), name='create-new-site'), - re_path(r'^cms/', include(wagtailadmin_urls)), - re_path(r'^$', RedirectView.as_view(url='/cms/')) + path('api-auth/', include(oauth2_urlpatterns)), + path('auto_auth/', core_views.AutoAuth.as_view(), name='auto_auth'), + path('health/', core_views.health, name='health'), + path('documents/', include(wagtaildocs_urls)), + path('pages/', include(wagtail_urls)), + path('cms/login/', core_views.wagtail_admin_access_check), + path('cms/logout/', RedirectView.as_view(url='/logout/')), + path('cms/sites/new/', SiteCreationView.as_view(), name='create-new-site'), + path('cms/', include(wagtailadmin_urls)), + path('', RedirectView.as_view(url='/cms/')) ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) if settings.DEBUG and os.environ.get('ENABLE_DJANGO_TOOLBAR', False): # pragma: no cover import debug_toolbar - urlpatterns.append(re_path(r'^__debug__/', include(debug_toolbar.urls))) + urlpatterns.append(path('__debug__/', include(debug_toolbar.urls))) diff --git a/tox.ini b/tox.ini index 22e1ca29..5bbb839a 100644 --- a/tox.ini +++ b/tox.ini @@ -9,7 +9,7 @@ testpaths = designer/apps [testenv] deps = django32: -r requirements/django.txt - django42: Django>=4.2,<4.3 + django42: Django>=4.2,<5.0 -r {toxinidir}/requirements/test.txt commands = {posargs:python -Wd -m pytest}