mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-28 00:49:49 +03:00
update given feedbacks on url() is deprecated in Django 3.1
This commit is contained in:
parent
b38e8e25b3
commit
2bd1845372
|
@ -32,7 +32,7 @@ Example:
|
|||
from blog import views
|
||||
|
||||
urlpatterns = [
|
||||
path('/', views.apt_root),
|
||||
path('', views.apt_root),
|
||||
path('comments/', views.comment_list),
|
||||
path('comments/<int:pk>/', views.comment_detail)
|
||||
]
|
||||
|
|
|
@ -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:
|
||||
|
||||
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')
|
||||
|
||||
---
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
||||
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.
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
from django.conf.urls import include
|
||||
from django.urls import path
|
||||
from django.urls import include, path
|
||||
|
||||
from rest_framework.renderers import (
|
||||
CoreJSONRenderer, DocumentationRenderer, SchemaJSRenderer
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
from django.conf.urls import include
|
||||
from django.urls import URLResolver, path, re_path, register_converter
|
||||
from django.urls import URLResolver, include, path, re_path, register_converter
|
||||
from django.urls.resolvers import RoutePattern
|
||||
|
||||
from rest_framework.settings import api_settings
|
||||
|
|
|
@ -2,11 +2,10 @@ import base64
|
|||
|
||||
import pytest
|
||||
from django.conf import settings
|
||||
from django.conf.urls import include
|
||||
from django.contrib.auth.models import User
|
||||
from django.http import HttpResponse
|
||||
from django.test import TestCase, override_settings
|
||||
from django.urls import path
|
||||
from django.urls import include, path
|
||||
|
||||
from rest_framework import (
|
||||
HTTP_HEADER_ENCODING, exceptions, permissions, renderers, status
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
from django.conf.urls import include
|
||||
from django.urls import path
|
||||
from django.urls import include, path
|
||||
|
||||
from .views import MockView
|
||||
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
import unittest
|
||||
|
||||
import pytest
|
||||
from django.conf.urls import include
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.http import Http404
|
||||
from django.test import TestCase, override_settings
|
||||
from django.urls import path
|
||||
from django.urls import include, path
|
||||
|
||||
from rest_framework import (
|
||||
filters, generics, pagination, permissions, serializers
|
||||
|
|
|
@ -3,13 +3,12 @@ from collections import OrderedDict
|
|||
from collections.abc import MutableMapping
|
||||
|
||||
import pytest
|
||||
from django.conf.urls import include
|
||||
from django.core.cache import cache
|
||||
from django.db import models
|
||||
from django.http.request import HttpRequest
|
||||
from django.template import loader
|
||||
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.translation import gettext_lazy as _
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
from django.conf.urls import include
|
||||
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.parsers import JSONParser
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
from collections import namedtuple
|
||||
|
||||
import pytest
|
||||
from django.conf.urls import include
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
from django.db import models
|
||||
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.decorators import action
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
import unittest
|
||||
from collections import namedtuple
|
||||
|
||||
from django.conf.urls import include
|
||||
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 rest_framework.test import APIRequestFactory
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import pytest
|
||||
from django.conf.urls import include
|
||||
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.decorators import APIView
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
from collections import OrderedDict
|
||||
|
||||
import pytest
|
||||
from django.conf.urls import include
|
||||
from django.db import models
|
||||
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.decorators import action
|
||||
|
|
Loading…
Reference in New Issue
Block a user