Skip to content

Commit 873f146

Browse files
Ryan P KilbyPierre Chiquet
authored andcommitted
Drop Django 1.10 support (encode#5657)
* Remove Django 1.10 from CI * Remove Django 1.10 compat code
1 parent c88c25d commit 873f146

File tree

13 files changed

+13
-51
lines changed

13 files changed

+13
-51
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ python:
99
sudo: false
1010

1111
env:
12-
- DJANGO=1.10
1312
- DJANGO=1.11
1413
- DJANGO=2.0
1514
- DJANGO=2.1

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ There is a live example API for testing purposes, [available here][sandbox].
5353
# Requirements
5454

5555
* Python (2.7, 3.4, 3.5, 3.6)
56-
* Django (1.10, 1.11, 2.0)
56+
* Django (1.11, 2.0)
5757

5858
# Installation
5959

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ continued development by **[signing up for a paid plan][funding]**.
8484
REST framework requires the following:
8585

8686
* Python (2.7, 3.4, 3.5, 3.6)
87-
* Django (1.10, 1.11, 2.0)
87+
* Django (1.11, 2.0)
8888

8989
The following packages are optional:
9090

requirements/requirements-optionals.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# Optional packages which may be used with REST framework.
2-
pytz==2017.2
32
psycopg2-binary==2.7.4
43
markdown==2.6.4
54
django-guardian==1.4.9

rest_framework/authentication.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@
66
import base64
77
import binascii
88

9-
from django.contrib.auth import get_user_model
9+
from django.contrib.auth import authenticate, get_user_model
1010
from django.middleware.csrf import CsrfViewMiddleware
1111
from django.utils.six import text_type
1212
from django.utils.translation import ugettext_lazy as _
1313

1414
from rest_framework import HTTP_HEADER_ENCODING, exceptions
15-
from rest_framework.compat import authenticate
1615

1716

1817
def get_authorization_header(request):

rest_framework/authtoken/serializers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
from django.contrib.auth import authenticate
12
from django.utils.translation import ugettext_lazy as _
23

34
from rest_framework import serializers
4-
from rest_framework.compat import authenticate
55

66

77
class AuthTokenSerializer(serializers.Serializer):

rest_framework/compat.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
from __future__ import unicode_literals
77

8-
import django
98
from django.conf import settings
109
from django.core import validators
1110
from django.utils import six
@@ -242,12 +241,6 @@ def md_filter_add_syntax_highlight(md):
242241
def md_filter_add_syntax_highlight(md):
243242
return False
244243

245-
# pytz is required from Django 1.11. Remove when dropping Django 1.10 support.
246-
try:
247-
import pytz # noqa
248-
from pytz.exceptions import InvalidTimeError
249-
except ImportError:
250-
InvalidTimeError = Exception
251244

252245
# Django 1.x url routing syntax. Remove when dropping Django 1.11 support.
253246
try:
@@ -298,11 +291,3 @@ class MinLengthValidator(CustomValidatorMessage, validators.MinLengthValidator):
298291

299292
class MaxLengthValidator(CustomValidatorMessage, validators.MaxLengthValidator):
300293
pass
301-
302-
303-
def authenticate(request=None, **credentials):
304-
from django.contrib.auth import authenticate
305-
if django.VERSION < (1, 11):
306-
return authenticate(**credentials)
307-
else:
308-
return authenticate(request=request, **credentials)

rest_framework/fields.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,12 @@
2929
from django.utils.ipv6 import clean_ipv6_address
3030
from django.utils.timezone import utc
3131
from django.utils.translation import ugettext_lazy as _
32+
from pytz.exceptions import InvalidTimeError
3233

3334
from rest_framework import ISO_8601
3435
from rest_framework.compat import (
35-
InvalidTimeError, MaxLengthValidator, MaxValueValidator,
36-
MinLengthValidator, MinValueValidator, unicode_repr, unicode_to_repr
36+
MaxLengthValidator, MaxValueValidator, MinLengthValidator,
37+
MinValueValidator, unicode_repr, unicode_to_repr
3738
)
3839
from rest_framework.exceptions import ErrorDetail, ValidationError
3940
from rest_framework.settings import api_settings

rest_framework/urls.py

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,11 @@
1313
"""
1414
from __future__ import unicode_literals
1515

16-
import django
1716
from django.conf.urls import url
1817
from django.contrib.auth import views
1918

20-
if django.VERSION < (1, 11):
21-
login = views.login
22-
login_kwargs = {'template_name': 'rest_framework/login.html'}
23-
logout = views.logout
24-
else:
25-
login = views.LoginView.as_view(template_name='rest_framework/login.html')
26-
login_kwargs = {}
27-
logout = views.LogoutView.as_view()
28-
29-
3019
app_name = 'rest_framework'
3120
urlpatterns = [
32-
url(r'^login/$', login, login_kwargs, name='login'),
33-
url(r'^logout/$', logout, name='logout'),
21+
url(r'^login/$', views.LoginView.as_view(template_name='rest_framework/login.html'), name='login'),
22+
url(r'^logout/$', views.LogoutView.as_view(), name='logout'),
3423
]

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ skip=.tox
1717
atomic=true
1818
multi_line_output=5
1919
known_standard_library=types
20-
known_third_party=pytest,_pytest,django
20+
known_third_party=pytest,_pytest,django,pytz
2121
known_first_party=rest_framework
2222

2323
[coverage:run]

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy