update given feedbacks on url() is deprecated in Django 3.1

This commit is contained in:
sanjusci 2020-07-19 09:39:03 +05:30 committed by Adam Johnson
parent 69e5381740
commit 108993dc7b
12 changed files with 12 additions and 21 deletions

View File

@ -32,7 +32,7 @@ Example:
from blog import views from blog import views
urlpatterns = [ urlpatterns = [
path('/', views.apt_root), path('', views.apt_root),
path('comments/', views.comment_list), path('comments/', views.comment_list),
path('comments/<int:pk>/', views.comment_detail) path('comments/<int:pk>/', views.comment_detail)
] ]

View File

@ -45,7 +45,7 @@ For more complex cases you might also want to override various methods on the vi
For very simple cases you might want to pass through any class attributes using the `.as_view()` method. For example, your URLconf might include something like the following entry: For very simple cases you might want to pass through any class attributes using the `.as_view()` method. For example, your URLconf might include something like the following entry:
path('/users/', ListCreateAPIView.as_view(queryset=User.objects.all(), serializer_class=UserSerializer), name='user-list') path('users/', ListCreateAPIView.as_view(queryset=User.objects.all(), serializer_class=UserSerializer), name='user-list')
--- ---

View File

@ -137,7 +137,7 @@ We can add a login view for use with the browsable API, by editing the URLconf i
Add the following import at the top of the file: Add the following import at the top of the file:
from django.conf.urls import include from django.urls import path, include
And, at the end of the file, add a pattern to include the login and logout views for the browsable API. And, at the end of the file, add a pattern to include the login and logout views for the browsable API.

View File

@ -2,11 +2,10 @@ import base64
import pytest import pytest
from django.conf import settings from django.conf import settings
from django.conf.urls import include
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.http import HttpResponse from django.http import HttpResponse
from django.test import TestCase, override_settings from django.test import TestCase, override_settings
from django.urls import path from django.urls import include, path
from rest_framework import ( from rest_framework import (
HTTP_HEADER_ENCODING, exceptions, permissions, renderers, status HTTP_HEADER_ENCODING, exceptions, permissions, renderers, status

View File

@ -1,5 +1,4 @@
from django.conf.urls import include from django.urls import include, path
from django.urls import path
from .views import MockView from .views import MockView

View File

@ -1,11 +1,10 @@
import unittest import unittest
import pytest import pytest
from django.conf.urls import include
from django.core.exceptions import PermissionDenied from django.core.exceptions import PermissionDenied
from django.http import Http404 from django.http import Http404
from django.test import TestCase, override_settings from django.test import TestCase, override_settings
from django.urls import path from django.urls import include, path
from rest_framework import ( from rest_framework import (
filters, generics, pagination, permissions, serializers filters, generics, pagination, permissions, serializers

View File

@ -3,13 +3,12 @@ from collections import OrderedDict
from collections.abc import MutableMapping from collections.abc import MutableMapping
import pytest import pytest
from django.conf.urls import include
from django.core.cache import cache from django.core.cache import cache
from django.db import models from django.db import models
from django.http.request import HttpRequest from django.http.request import HttpRequest
from django.template import loader from django.template import loader
from django.test import TestCase, override_settings from django.test import TestCase, override_settings
from django.urls import path, re_path from django.urls import include, path, re_path
from django.utils.safestring import SafeText from django.utils.safestring import SafeText
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _

View File

@ -1,6 +1,5 @@
from django.conf.urls import include
from django.test import TestCase, override_settings from django.test import TestCase, override_settings
from django.urls import path, re_path from django.urls import include, path, re_path
from rest_framework import generics, routers, serializers, status, viewsets from rest_framework import generics, routers, serializers, status, viewsets
from rest_framework.parsers import JSONParser from rest_framework.parsers import JSONParser

View File

@ -1,11 +1,10 @@
from collections import namedtuple from collections import namedtuple
import pytest import pytest
from django.conf.urls import include
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
from django.db import models from django.db import models
from django.test import TestCase, override_settings from django.test import TestCase, override_settings
from django.urls import path, resolve, reverse from django.urls import include, path, resolve, reverse
from rest_framework import permissions, serializers, viewsets from rest_framework import permissions, serializers, viewsets
from rest_framework.decorators import action from rest_framework.decorators import action

View File

@ -1,8 +1,7 @@
from collections import namedtuple from collections import namedtuple
from django.conf.urls import include
from django.test import TestCase from django.test import TestCase
from django.urls import Resolver404, URLResolver, path, re_path from django.urls import Resolver404, URLResolver, include, path, re_path
from django.urls.resolvers import RegexPattern from django.urls.resolvers import RegexPattern
from rest_framework.test import APIRequestFactory from rest_framework.test import APIRequestFactory

View File

@ -1,7 +1,6 @@
import pytest import pytest
from django.conf.urls import include
from django.test import override_settings from django.test import override_settings
from django.urls import path, re_path from django.urls import include, path, re_path
from rest_framework import serializers, status, versioning from rest_framework import serializers, status, versioning
from rest_framework.decorators import APIView from rest_framework.decorators import APIView

View File

@ -2,10 +2,9 @@ from collections import OrderedDict
from functools import wraps from functools import wraps
import pytest import pytest
from django.conf.urls import include
from django.db import models from django.db import models
from django.test import TestCase, override_settings from django.test import TestCase, override_settings
from django.urls import path from django.urls import include, path
from rest_framework import status from rest_framework import status
from rest_framework.decorators import action from rest_framework.decorators import action