Remove compat urls for Django < 2.0 (#7335)

This commit is contained in:
Jair Henrique 2020-05-14 10:48:14 -03:00 committed by GitHub
parent aed74961ba
commit b83e9121f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 14 deletions

View File

@ -212,16 +212,6 @@ else:
return False
# Django 1.x url routing syntax. Remove when dropping Django 1.11 support.
try:
from django.urls import include, path, re_path, register_converter # noqa
except ImportError:
from django.conf.urls import include, url # noqa
path = None
register_converter = None
re_path = url
# `separators` argument to `json.dumps()` differs between 2.x and 3.x
# See: https://bugs.python.org/issue22767
SHORT_SEPARATORS = (',', ':')

View File

@ -1,7 +1,8 @@
from django.conf.urls import include, url
from django.urls import path, register_converter
from rest_framework.compat import (
URLResolver, get_regex_pattern, is_route_pattern, path, register_converter
URLResolver, get_regex_pattern, is_route_pattern
)
from rest_framework.settings import api_settings

View File

@ -5,11 +5,12 @@ from django.conf.urls import include, url
from django.core.exceptions import PermissionDenied
from django.http import Http404
from django.test import TestCase, override_settings
from django.urls import path
from rest_framework import (
filters, generics, pagination, permissions, serializers
)
from rest_framework.compat import coreapi, coreschema, get_regex_pattern, path
from rest_framework.compat import coreapi, coreschema, get_regex_pattern
from rest_framework.decorators import action, api_view, schema
from rest_framework.request import Request
from rest_framework.routers import DefaultRouter, SimpleRouter

View File

@ -3,9 +3,9 @@ from collections import namedtuple
from django.conf.urls import include, url
from django.test import TestCase
from django.urls import Resolver404
from django.urls import Resolver404, path, re_path
from rest_framework.compat import make_url_resolver, path, re_path
from rest_framework.compat import make_url_resolver
from rest_framework.test import APIRequestFactory
from rest_framework.urlpatterns import format_suffix_patterns