diff --git a/docs/api-guide/format-suffixes.md b/docs/api-guide/format-suffixes.md index 0aa75dbef..dfdf24953 100644 --- a/docs/api-guide/format-suffixes.md +++ b/docs/api-guide/format-suffixes.md @@ -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//', views.comment_detail) ] diff --git a/docs/api-guide/generic-views.md b/docs/api-guide/generic-views.md index 26344536b..afc2cab56 100644 --- a/docs/api-guide/generic-views.md +++ b/docs/api-guide/generic-views.md @@ -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') --- diff --git a/docs/tutorial/4-authentication-and-permissions.md b/docs/tutorial/4-authentication-and-permissions.md index 6808780fa..79ce355c9 100644 --- a/docs/tutorial/4-authentication-and-permissions.md +++ b/docs/tutorial/4-authentication-and-permissions.md @@ -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. diff --git a/tests/authentication/test_authentication.py b/tests/authentication/test_authentication.py index d3cafc00e..a73e0d79c 100644 --- a/tests/authentication/test_authentication.py +++ b/tests/authentication/test_authentication.py @@ -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 diff --git a/tests/browsable_api/auth_urls.py b/tests/browsable_api/auth_urls.py index 28f168666..151278cbd 100644 --- a/tests/browsable_api/auth_urls.py +++ b/tests/browsable_api/auth_urls.py @@ -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 diff --git a/tests/schemas/test_coreapi.py b/tests/schemas/test_coreapi.py index 1bebaff57..7b1f15fef 100644 --- a/tests/schemas/test_coreapi.py +++ b/tests/schemas/test_coreapi.py @@ -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 diff --git a/tests/test_renderers.py b/tests/test_renderers.py index fddd5e2dd..8271608e1 100644 --- a/tests/test_renderers.py +++ b/tests/test_renderers.py @@ -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 _ diff --git a/tests/test_response.py b/tests/test_response.py index c52a1b21d..0d5528dc9 100644 --- a/tests/test_response.py +++ b/tests/test_response.py @@ -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 diff --git a/tests/test_routers.py b/tests/test_routers.py index ba5cdc4c2..f767a843d 100644 --- a/tests/test_routers.py +++ b/tests/test_routers.py @@ -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 diff --git a/tests/test_urlpatterns.py b/tests/test_urlpatterns.py index d789cbf68..12ed32d9c 100644 --- a/tests/test_urlpatterns.py +++ b/tests/test_urlpatterns.py @@ -1,8 +1,7 @@ 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 diff --git a/tests/test_versioning.py b/tests/test_versioning.py index 99a3a592b..d40d54229 100644 --- a/tests/test_versioning.py +++ b/tests/test_versioning.py @@ -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 diff --git a/tests/test_viewsets.py b/tests/test_viewsets.py index 2217bb0c9..8842b0b1c 100644 --- a/tests/test_viewsets.py +++ b/tests/test_viewsets.py @@ -2,10 +2,9 @@ from collections import OrderedDict from functools import wraps 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