Commit c8ad0cce by Tom Christie

Bump minimum Django version to 1.5

parent 5b39d820
...@@ -23,8 +23,6 @@ env: ...@@ -23,8 +23,6 @@ env:
- TOX_ENV=py32-django15 - TOX_ENV=py32-django15
- TOX_ENV=py27-django15 - TOX_ENV=py27-django15
- TOX_ENV=py26-django15 - TOX_ENV=py26-django15
- TOX_ENV=py27-django14
- TOX_ENV=py26-django14
- TOX_ENV=py27-djangomaster - TOX_ENV=py27-djangomaster
- TOX_ENV=py32-djangomaster - TOX_ENV=py32-djangomaster
- TOX_ENV=py33-djangomaster - TOX_ENV=py33-djangomaster
......
...@@ -36,7 +36,7 @@ There is a live example API for testing purposes, [available here][sandbox]. ...@@ -36,7 +36,7 @@ There is a live example API for testing purposes, [available here][sandbox].
# Requirements # Requirements
* Python (2.6.5+, 2.7, 3.2, 3.3, 3.4) * 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 # Installation
......
...@@ -53,7 +53,7 @@ Some reasons you might want to use REST framework: ...@@ -53,7 +53,7 @@ Some reasons you might want to use REST framework:
REST framework requires the following: REST framework requires the following:
* Python (2.6.5+, 2.7, 3.2, 3.3, 3.4) * 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: The following packages are optional:
......
...@@ -317,7 +317,7 @@ Quit out of the shell... ...@@ -317,7 +317,7 @@ Quit out of the shell...
Validating models... Validating models...
0 errors found 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/ Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C. Quit the server with CONTROL-C.
......
...@@ -203,41 +203,6 @@ if 'patch' not in View.http_method_names: ...@@ -203,41 +203,6 @@ if 'patch' not in View.http_method_names:
View.http_method_names = View.http_method_names + ['patch'] 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 # Markdown is optional
try: try:
import markdown import markdown
......
...@@ -11,7 +11,6 @@ The wrapped request then offers a richer API, in particular : ...@@ -11,7 +11,6 @@ The wrapped request then offers a richer API, in particular :
from __future__ import unicode_literals from __future__ import unicode_literals
import sys import sys
import warnings
from django.conf import settings from django.conf import settings
from django.http import QueryDict from django.http import QueryDict
......
...@@ -12,8 +12,6 @@ response content is handled by parsers and renderers. ...@@ -12,8 +12,6 @@ response content is handled by parsers and renderers.
""" """
from __future__ import unicode_literals from __future__ import unicode_literals
import warnings
from django.db import models from django.db import models
from django.db.models.fields import Field as DjangoModelField from django.db.models.fields import Field as DjangoModelField
from django.db.models.fields import FieldDoesNotExist from django.db.models.fields import FieldDoesNotExist
......
...@@ -8,12 +8,12 @@ import django ...@@ -8,12 +8,12 @@ import django
from django.conf import settings from django.conf import settings
from django.test import testcases from django.test import testcases
from django.test.client import Client as DjangoClient from django.test.client import Client as DjangoClient
from django.test.client import RequestFactory as DjangoRequestFactory
from django.test.client import ClientHandler from django.test.client import ClientHandler
from django.utils import six from django.utils import six
from django.utils.encoding import force_bytes
from django.utils.http import urlencode 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 from rest_framework.settings import api_settings
...@@ -47,7 +47,7 @@ class APIRequestFactory(DjangoRequestFactory): ...@@ -47,7 +47,7 @@ class APIRequestFactory(DjangoRequestFactory):
if content_type: if content_type:
# Content type specified explicitly, treat data as a raw bytestring # 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: else:
format = format or self.default_format format = format or self.default_format
......
...@@ -3,9 +3,6 @@ Provides an APIView class that is the base of all views in REST framework. ...@@ -3,9 +3,6 @@ Provides an APIView class that is the base of all views in REST framework.
""" """
from __future__ import unicode_literals from __future__ import unicode_literals
import inspect
import warnings
from django.core.exceptions import PermissionDenied from django.core.exceptions import PermissionDenied
from django.db import models from django.db import models
from django.http import Http404 from django.http import Http404
......
...@@ -13,7 +13,6 @@ commands = ./runtests.py --fast {posargs} ...@@ -13,7 +13,6 @@ commands = ./runtests.py --fast {posargs}
setenv = setenv =
PYTHONDONTWRITEBYTECODE=1 PYTHONDONTWRITEBYTECODE=1
deps = deps =
django14: Django==1.4.11 # Should track minimum supported
django15: Django==1.5.6 # Should track minimum supported django15: Django==1.5.6 # Should track minimum supported
django16: Django==1.6.3 # Should track minimum supported django16: Django==1.6.3 # Should track minimum supported
django17: Django==1.7.8 # Should track maximum supported django17: Django==1.7.8 # Should track maximum supported
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment