Django 1.9 support

This commit is contained in:
Tom Christie 2015-09-28 11:44:07 +01:00
parent c4211ce7d8
commit 02e1f69d2b
5 changed files with 42 additions and 35 deletions

View File

@ -5,6 +5,9 @@ sudo: false
env:
- TOX_ENV=py27-lint
- TOX_ENV=py27-docs
- TOX_ENV=py35-django19
- TOX_ENV=py34-django19
- TOX_ENV=py27-django19
- TOX_ENV=py34-django18
- TOX_ENV=py33-django18
- TOX_ENV=py32-django18
@ -13,16 +16,12 @@ env:
- TOX_ENV=py33-django17
- TOX_ENV=py32-django17
- TOX_ENV=py27-django17
- TOX_ENV=py27-djangomaster
- TOX_ENV=py34-djangomaster
- TOX_ENV=py35-djangomaster
matrix:
# Python 3.5 not yet available on travis, watch this to see when it is.
fast_finish: true
allow_failures:
- env: TOX_ENV=py27-djangomaster
- env: TOX_ENV=py34-djangomaster
- env: TOX_ENV=py35-djangomaster
- env: TOX_ENV=py35-django19
install:
- pip install tox

View File

@ -36,8 +36,8 @@ There is a live example API for testing purposes, [available here][sandbox].
# Requirements
* Python (2.7, 3.2, 3.3, 3.4)
* Django (1.7, 1.8)
* Python (2.7, 3.2, 3.3, 3.4, 3.5)
* Django (1.7, 1.8, 1.9)
# Installation

View File

@ -52,8 +52,8 @@ 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.5.6+, 1.6.3+, 1.7+, 1.8)
* Python (2.6.5+, 2.7, 3.2, 3.3, 3.4, 3.5)
* Django (1.7+, 1.8, 1.9)
The following packages are optional:

View File

@ -112,6 +112,14 @@ def get_field_kwargs(field_name, model_field):
kwargs['choices'] = model_field.choices
return kwargs
# Our decimal validation is handled in the field code, not validator code.
# (In Django 1.9+ this differs from previous style)
if isinstance(model_field, models.DecimalField):
validator_kwarg = [
validator for validator in validator_kwarg
if not isinstance(validator, validators.DecimalValidator)
]
# Ensure that max_length is passed explicitly as a keyword arg,
# rather than as a validator.
max_length = getattr(model_field, 'max_length', None)

50
tox.ini
View File

@ -5,7 +5,7 @@ addopts=--tb=short
envlist =
py27-{lint,docs},
{py27,py32,py33,py34}-django{17,18},
{py27,py34,py35}-django{master}
{py27,py34,py35}-django{19}
[testenv]
basepython =
@ -19,17 +19,17 @@ commands = ./runtests.py --fast {posargs} --coverage
setenv =
PYTHONDONTWRITEBYTECODE=1
deps =
django17: Django==1.7.10 # Should track maximum supported
django18: Django==1.8.4 # Should track maximum supported
djangomaster: https://github.com/django/django/archive/master.tar.gz
-rrequirements/requirements-testing.txt
-rrequirements/requirements-optionals.txt
django17: Django==1.7.10 # Should track maximum supported
django18: Django==1.8.4 # Should track maximum supported
django19: https://www.djangoproject.com/download/1.9a1/tarball/
-rrequirements/requirements-testing.txt
-rrequirements/requirements-optionals.txt
[testenv:py27-lint]
commands = ./runtests.py --lintonly
deps =
-rrequirements/requirements-codestyle.txt
-rrequirements/requirements-testing.txt
-rrequirements/requirements-codestyle.txt
-rrequirements/requirements-testing.txt
[testenv:py27-docs]
commands = mkdocs build
@ -37,24 +37,24 @@ deps =
-rrequirements/requirements-testing.txt
-rrequirements/requirements-documentation.txt
# Specify explicitly to exclude Django Guardian against Django master (various Pythons)
[testenv:py27-djangomaster]
# Specify explicitly to exclude Django Guardian against Django 1.9
[testenv:py27-django19]
deps =
https://github.com/django/django/archive/master.tar.gz
-rrequirements/requirements-testing.txt
markdown==2.5.2
django-filter==0.10.0
[testenv:py34-djangomaster]
deps =
https://github.com/django/django/archive/master.tar.gz
-rrequirements/requirements-testing.txt
markdown==2.5.2
django-filter==0.10.0
https://www.djangoproject.com/download/1.9a1/tarball/
-rrequirements/requirements-testing.txt
markdown==2.5.2
django-filter==0.10.0
[testenv:py35-djangomaster]
[testenv:py34-django19]
deps =
https://github.com/django/django/archive/master.tar.gz
-rrequirements/requirements-testing.txt
markdown==2.5.2
django-filter==0.10.0
https://www.djangoproject.com/download/1.9a1/tarball/
-rrequirements/requirements-testing.txt
markdown==2.5.2
django-filter==0.10.0
[testenv:py35-django19]
deps =
https://www.djangoproject.com/download/1.9a1/tarball/
-rrequirements/requirements-testing.txt
markdown==2.5.2
django-filter==0.10.0