From 5b39d820bea1bea66bec9d1461858c2830125c2f Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Thu, 30 Jul 2015 15:13:22 +0100 Subject: [PATCH 1/2] Remove 'load url from future' tags in templates. --- rest_framework/templates/rest_framework/admin.html | 1 - rest_framework/templates/rest_framework/base.html | 1 - rest_framework/templates/rest_framework/login_base.html | 1 - 3 files changed, 3 deletions(-) diff --git a/rest_framework/templates/rest_framework/admin.html b/rest_framework/templates/rest_framework/admin.html index 74dc7316c..7db06e07c 100644 --- a/rest_framework/templates/rest_framework/admin.html +++ b/rest_framework/templates/rest_framework/admin.html @@ -1,4 +1,3 @@ -{% load url from future %} {% load staticfiles %} {% load rest_framework %} diff --git a/rest_framework/templates/rest_framework/base.html b/rest_framework/templates/rest_framework/base.html index 449cd3802..abbc75952 100644 --- a/rest_framework/templates/rest_framework/base.html +++ b/rest_framework/templates/rest_framework/base.html @@ -1,4 +1,3 @@ -{% load url from future %} {% load staticfiles %} {% load rest_framework %} diff --git a/rest_framework/templates/rest_framework/login_base.html b/rest_framework/templates/rest_framework/login_base.html index 9ac80308b..7f2bfb51b 100644 --- a/rest_framework/templates/rest_framework/login_base.html +++ b/rest_framework/templates/rest_framework/login_base.html @@ -1,5 +1,4 @@ {% extends "rest_framework/base.html" %} -{% load url from future %} {% load staticfiles %} {% load rest_framework %} From c8ad0cce198533bce31afcb919caea659e6ea093 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Thu, 30 Jul 2015 15:43:39 +0100 Subject: [PATCH 2/2] Bump minimum Django version to 1.5 --- .travis.yml | 2 -- README.md | 2 +- docs/index.md | 2 +- docs/tutorial/1-serialization.md | 2 +- rest_framework/compat.py | 35 -------------------------------- rest_framework/request.py | 1 - rest_framework/serializers.py | 2 -- rest_framework/test.py | 6 +++--- rest_framework/views.py | 3 --- tox.ini | 1 - 10 files changed, 6 insertions(+), 50 deletions(-) diff --git a/.travis.yml b/.travis.yml index 50dc368e4..c653aa83a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,8 +23,6 @@ env: - TOX_ENV=py32-django15 - TOX_ENV=py27-django15 - TOX_ENV=py26-django15 - - TOX_ENV=py27-django14 - - TOX_ENV=py26-django14 - TOX_ENV=py27-djangomaster - TOX_ENV=py32-djangomaster - TOX_ENV=py33-djangomaster diff --git a/README.md b/README.md index af8ac58e4..8ba866808 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ There is a live example API for testing purposes, [available here][sandbox]. # Requirements * Python (2.6.5+, 2.7, 3.2, 3.3, 3.4) -* Django (1.4.11+, 1.5.6+, 1.6.3+, 1.7, 1.8) +* Django (1.5.6+, 1.6.3+, 1.7, 1.8) # Installation diff --git a/docs/index.md b/docs/index.md index 27c50fee8..4a8442ced 100644 --- a/docs/index.md +++ b/docs/index.md @@ -53,7 +53,7 @@ Some reasons you might want to use REST framework: REST framework requires the following: * Python (2.6.5+, 2.7, 3.2, 3.3, 3.4) -* Django (1.4.11+, 1.5.6+, 1.6.3+, 1.7+, 1.8) +* Django (1.5.6+, 1.6.3+, 1.7+, 1.8) The following packages are optional: diff --git a/docs/tutorial/1-serialization.md b/docs/tutorial/1-serialization.md index 8a7a8dc07..c54af0cec 100644 --- a/docs/tutorial/1-serialization.md +++ b/docs/tutorial/1-serialization.md @@ -317,7 +317,7 @@ Quit out of the shell... Validating models... 0 errors found - Django version 1.4.3, using settings 'tutorial.settings' + Django version 1.8.3, using settings 'tutorial.settings' Development server is running at http://127.0.0.1:8000/ Quit the server with CONTROL-C. diff --git a/rest_framework/compat.py b/rest_framework/compat.py index d11c68093..b1153d666 100644 --- a/rest_framework/compat.py +++ b/rest_framework/compat.py @@ -203,41 +203,6 @@ if 'patch' not in View.http_method_names: View.http_method_names = View.http_method_names + ['patch'] - -try: - # In 1.5 the test client uses force_bytes - from django.utils.encoding import force_bytes as force_bytes_or_smart_bytes -except ImportError: - # In 1.4 the test client just uses smart_str - from django.utils.encoding import smart_str as force_bytes_or_smart_bytes - - -# RequestFactory only provides `generic` from 1.5 onwards -if django.VERSION >= (1, 5): - from django.test.client import RequestFactory -else: - from django.test.client import RequestFactory as DjangoRequestFactory - - class RequestFactory(DjangoRequestFactory): - def generic(self, method, path, - data='', content_type='application/octet-stream', **extra): - parsed = _urlparse(path) - data = force_bytes_or_smart_bytes(data, settings.DEFAULT_CHARSET) - r = { - 'PATH_INFO': self._get_path(parsed), - 'QUERY_STRING': force_text(parsed[4]), - 'REQUEST_METHOD': six.text_type(method), - } - if data: - r.update({ - 'CONTENT_LENGTH': len(data), - 'CONTENT_TYPE': six.text_type(content_type), - 'wsgi.input': FakePayload(data), - }) - r.update(extra) - return self.request(**r) - - # Markdown is optional try: import markdown diff --git a/rest_framework/request.py b/rest_framework/request.py index 568ba1b50..79f251ead 100644 --- a/rest_framework/request.py +++ b/rest_framework/request.py @@ -11,7 +11,6 @@ The wrapped request then offers a richer API, in particular : from __future__ import unicode_literals import sys -import warnings from django.conf import settings from django.http import QueryDict diff --git a/rest_framework/serializers.py b/rest_framework/serializers.py index cb0404b64..f3873d3bf 100644 --- a/rest_framework/serializers.py +++ b/rest_framework/serializers.py @@ -12,8 +12,6 @@ response content is handled by parsers and renderers. """ from __future__ import unicode_literals -import warnings - from django.db import models from django.db.models.fields import Field as DjangoModelField from django.db.models.fields import FieldDoesNotExist diff --git a/rest_framework/test.py b/rest_framework/test.py index 92ac09f58..e0670365b 100644 --- a/rest_framework/test.py +++ b/rest_framework/test.py @@ -8,12 +8,12 @@ import django from django.conf import settings from django.test import testcases from django.test.client import Client as DjangoClient +from django.test.client import RequestFactory as DjangoRequestFactory from django.test.client import ClientHandler from django.utils import six +from django.utils.encoding import force_bytes from django.utils.http import urlencode -from rest_framework.compat import RequestFactory as DjangoRequestFactory -from rest_framework.compat import force_bytes_or_smart_bytes from rest_framework.settings import api_settings @@ -47,7 +47,7 @@ class APIRequestFactory(DjangoRequestFactory): if content_type: # Content type specified explicitly, treat data as a raw bytestring - ret = force_bytes_or_smart_bytes(data, settings.DEFAULT_CHARSET) + ret = force_bytes(data, settings.DEFAULT_CHARSET) else: format = format or self.default_format diff --git a/rest_framework/views.py b/rest_framework/views.py index ca91d19d2..415770839 100644 --- a/rest_framework/views.py +++ b/rest_framework/views.py @@ -3,9 +3,6 @@ Provides an APIView class that is the base of all views in REST framework. """ from __future__ import unicode_literals -import inspect -import warnings - from django.core.exceptions import PermissionDenied from django.db import models from django.http import Http404 diff --git a/tox.ini b/tox.ini index d941b6d78..84f406246 100644 --- a/tox.ini +++ b/tox.ini @@ -13,7 +13,6 @@ commands = ./runtests.py --fast {posargs} setenv = PYTHONDONTWRITEBYTECODE=1 deps = - django14: Django==1.4.11 # Should track minimum supported django15: Django==1.5.6 # Should track minimum supported django16: Django==1.6.3 # Should track minimum supported django17: Django==1.7.8 # Should track maximum supported