From e75fee0f89f9fe272e1e67eacdd67e21c2de56a8 Mon Sep 17 00:00:00 2001 From: Oliver Sauder Date: Tue, 14 Dec 2021 10:57:36 +0400 Subject: [PATCH] Updated urls to use path and re_path as is default in Django 2.2. django.urls.conf.url is only there for Python 3.5 support which we already deleted anyway. --- example/urls.py | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/example/urls.py b/example/urls.py index 867f1bd7..84ca1e9f 100644 --- a/example/urls.py +++ b/example/urls.py @@ -1,6 +1,5 @@ from django.conf import settings -from django.conf.urls import include, url -from django.urls import path +from django.urls import include, path, re_path from django.views.generic import TemplateView from rest_framework import routers from rest_framework.schemas import get_schema_view @@ -36,53 +35,53 @@ router.register(r"lab-results", LabResultViewSet) urlpatterns = [ - url(r"^", include(router.urls)), - url( + path("", include(router.urls)), + re_path( r"^entries/(?P[^/.]+)/suggested/$", EntryViewSet.as_view({"get": "list"}), name="entry-suggested", ), - url( + re_path( r"entries/(?P[^/.]+)/blog$", BlogViewSet.as_view({"get": "retrieve"}), name="entry-blog", ), - url( + re_path( r"entries/(?P[^/.]+)/comments$", CommentViewSet.as_view({"get": "list"}), name="entry-comments", ), - url( + re_path( r"entries/(?P[^/.]+)/authors$", AuthorViewSet.as_view({"get": "list"}), name="entry-authors", ), - url( + re_path( r"entries/(?P[^/.]+)/featured$", EntryViewSet.as_view({"get": "retrieve"}), name="entry-featured", ), - url( + re_path( r"^authors/(?P[^/.]+)/(?P\w+)/$", AuthorViewSet.as_view({"get": "retrieve_related"}), name="author-related", ), - url( + re_path( r"^entries/(?P[^/.]+)/relationships/(?P\w+)$", EntryRelationshipView.as_view(), name="entry-relationships", ), - url( + re_path( r"^blogs/(?P[^/.]+)/relationships/(?P\w+)$", BlogRelationshipView.as_view(), name="blog-relationships", ), - url( + re_path( r"^comments/(?P[^/.]+)/relationships/(?P\w+)$", CommentRelationshipView.as_view(), name="comment-relationships", ), - url( + re_path( r"^authors/(?P[^/.]+)/relationships/(?P\w+)$", AuthorRelationshipView.as_view(), name="author-relationships", @@ -111,5 +110,5 @@ import debug_toolbar urlpatterns = [ - url(r"^__debug__/", include(debug_toolbar.urls)), + path("__debug__/", include(debug_toolbar.urls)), ] + urlpatterns