mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-02 20:54:42 +03:00
Bump minimum Django version to 1.5
This commit is contained in:
parent
5b39d820be
commit
c8ad0cce19
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
1
tox.ini
1
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
|
||||
|
|
Loading…
Reference in New Issue
Block a user