-
Notifications
You must be signed in to change notification settings - Fork 433
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use path/re_path instead of url to squelch Django 4.0 warnings
- Loading branch information
Showing
15 changed files
with
68 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,9 @@ | ||
import django | ||
|
||
from . import views | ||
|
||
if django.VERSION[:2] >= (2, 0): | ||
from django.urls import path | ||
|
||
urlpatterns = [ | ||
path('', views.SnippetList.as_view()), | ||
path('<int:pk>/', views.SnippetDetail.as_view()), | ||
path('views/<int:snippet_pk>/', views.SnippetViewerList.as_view()), | ||
] | ||
else: | ||
from django.conf.urls import url | ||
from django.urls import path | ||
|
||
urlpatterns = [ | ||
url('^$', views.SnippetList.as_view()), | ||
url(r'^(?P<pk>\d+)/$', views.SnippetDetail.as_view()), | ||
url(r'^views/(?P<snippet_pk>\d+)/$', views.SnippetViewerList.as_view()), | ||
] | ||
urlpatterns = [ | ||
path('', views.SnippetList.as_view()), | ||
path('<int:pk>/', views.SnippetDetail.as_view()), | ||
path('views/<int:snippet_pk>/', views.SnippetViewerList.as_view()), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
from django.conf.urls import url | ||
from django.urls import path | ||
|
||
from users import views | ||
|
||
urlpatterns = [ | ||
url(r'^$', views.UserList.as_view()), | ||
url(r'^(?P<pk>\d+)/$', views.user_detail), | ||
path('', views.UserList.as_view()), | ||
path('<int:pk>/', views.user_detail), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
from django.conf.urls import include, url | ||
from django.urls import path, re_path, include | ||
from rest_framework import versioning | ||
|
||
from testproj.urls import SchemaView, required_urlpatterns | ||
|
||
from . import ns_version1, ns_version2 | ||
|
||
VERSION_PREFIX_NS = r"^versioned/ns/" | ||
VERSION_PREFIX_NS = r"versioned/ns/" | ||
|
||
|
||
class VersionedSchemaView(SchemaView): | ||
versioning_class = versioning.NamespaceVersioning | ||
|
||
|
||
schema_patterns = [ | ||
url(r'swagger(?P<format>.json|.yaml)$', VersionedSchemaView.without_ui(), name='ns-schema') | ||
re_path(r'swagger(?P<format>.json|.yaml)$', VersionedSchemaView.without_ui(), name='ns-schema') | ||
] | ||
|
||
|
||
urlpatterns = required_urlpatterns + [ | ||
url(VERSION_PREFIX_NS + r"v1.0/snippets/", include(ns_version1, namespace='1.0')), | ||
url(VERSION_PREFIX_NS + r"v2.0/snippets/", include(ns_version2)), | ||
url(VERSION_PREFIX_NS + r'v1.0/', include((schema_patterns, '1.0'))), | ||
url(VERSION_PREFIX_NS + r'v2.0/', include((schema_patterns, '2.0'))), | ||
path(VERSION_PREFIX_NS + "v1.0/snippets/", include(ns_version1, namespace='1.0')), | ||
path(VERSION_PREFIX_NS + "v2.0/snippets/", include(ns_version2)), | ||
path(VERSION_PREFIX_NS + "v1.0/", include((schema_patterns, '1.0'))), | ||
path(VERSION_PREFIX_NS + "v2.0/", include((schema_patterns, '2.0'))), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters