Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-rest-framework
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
django-rest-framework
Commits
c4211ce7
Commit
c4211ce7
authored
Sep 28, 2015
by
Tom Christie
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3449 from tomchristie/carltongibson-drop-django-16
Drop django 16
parents
4762a73e
2d0b54e2
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
33 additions
and
70 deletions
+33
-70
.travis.yml
+0
-5
README.md
+2
-2
docs/topics/release-notes.md
+2
-1
rest_framework/compat.py
+0
-36
rest_framework/fields.py
+3
-2
rest_framework/metadata.py
+2
-1
rest_framework/pagination.py
+1
-2
rest_framework/relations.py
+2
-1
rest_framework/routers.py
+1
-2
rest_framework/utils/model_meta.py
+3
-4
rest_framework/utils/serializer_helpers.py
+2
-1
tests/test_atomic_requests.py
+2
-1
tests/test_filters.py
+2
-1
tests/test_model_serializer.py
+2
-1
tests/test_permissions.py
+2
-1
tests/test_relations_generic.py
+3
-1
tests/test_renderers.py
+1
-2
tests/test_utils.py
+3
-3
tox.ini
+0
-3
No files found.
.travis.yml
View file @
c4211ce7
...
...
@@ -13,11 +13,6 @@ env:
-
TOX_ENV=py33-django17
-
TOX_ENV=py32-django17
-
TOX_ENV=py27-django17
-
TOX_ENV=py34-django16
-
TOX_ENV=py33-django16
-
TOX_ENV=py32-django16
-
TOX_ENV=py27-django16
-
TOX_ENV=py26-django16
-
TOX_ENV=py27-djangomaster
-
TOX_ENV=py34-djangomaster
-
TOX_ENV=py35-djangomaster
...
...
README.md
View file @
c4211ce7
...
...
@@ -36,8 +36,8 @@ 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.
6.3+, 1.
7, 1.8)
*
Python (2.7, 3.2, 3.3, 3.4)
*
Django (1.7, 1.8)
# Installation
...
...
docs/topics/release-notes.md
View file @
c4211ce7
...
...
@@ -44,7 +44,7 @@ You can determine your currently installed version using `pip freeze`:
*
*Date
**
:
NOT YET RELEASED
*
Removed support for Django Version
1.5 ([#3421][gh3421
])
*
Removed support for Django Version
s 1.5 & 1.6 ([#3421][gh3421], [#3429][gh3429
])
## 3.2.x series
...
...
@@ -544,3 +544,4 @@ For older release notes, [please see the version 2.x documentation][old-release-
<!-- 3.3.0 -->
[
gh3421
]:
https://github.com/tomchristie/django-rest-framework/pulls/3421
[
gh3429
]:
https://github.com/tomchristie/django-rest-framework/pull/3429
rest_framework/compat.py
View file @
c4211ce7
...
...
@@ -57,24 +57,6 @@ def distinct(queryset, base):
return
queryset
.
distinct
()
# OrderedDict only available in Python 2.7.
# This will always be the case in Django 1.7 and above, as these versions
# no longer support Python 2.6.
# For Django <= 1.6 and Python 2.6 fall back to SortedDict.
try
:
from
collections
import
OrderedDict
except
ImportError
:
from
django.utils.datastructures
import
SortedDict
as
OrderedDict
# unittest.SkipUnless only available in Python 2.7.
try
:
import
unittest
unittest
.
skipUnless
except
(
ImportError
,
AttributeError
):
from
django.utils
import
unittest
# contrib.postgres only supported from 1.8 onwards.
try
:
from
django.contrib.postgres
import
fields
as
postgres_fields
...
...
@@ -82,24 +64,6 @@ except ImportError:
postgres_fields
=
None
# Apps only exists from 1.7 onwards.
try
:
from
django.apps
import
apps
get_model
=
apps
.
get_model
except
ImportError
:
from
django.db.models
import
get_model
# Import path changes from 1.7 onwards.
try
:
from
django.contrib.contenttypes.fields
import
(
GenericForeignKey
,
GenericRelation
)
except
ImportError
:
from
django.contrib.contenttypes.generic
import
(
GenericForeignKey
,
GenericRelation
)
# django-filter is optional
try
:
import
django_filters
...
...
rest_framework/fields.py
View file @
c4211ce7
...
...
@@ -7,6 +7,7 @@ import decimal
import
inspect
import
re
import
uuid
from
collections
import
OrderedDict
from
django.conf
import
settings
from
django.core.exceptions
import
ValidationError
as
DjangoValidationError
...
...
@@ -26,8 +27,8 @@ from django.utils.translation import ugettext_lazy as _
from
rest_framework
import
ISO_8601
from
rest_framework.compat
import
(
MaxLengthValidator
,
MaxValueValidator
,
MinLengthValidator
,
MinValueValidator
,
OrderedDict
,
duration_string
,
parse_duration
,
unicode_
repr
,
unicode_
to_repr
MinValueValidator
,
duration_string
,
parse_duration
,
unicode_repr
,
unicode_to_repr
)
from
rest_framework.exceptions
import
ValidationError
from
rest_framework.settings
import
api_settings
...
...
rest_framework/metadata.py
View file @
c4211ce7
...
...
@@ -8,12 +8,13 @@ to return this information in a more standardized way.
"""
from
__future__
import
unicode_literals
from
collections
import
OrderedDict
from
django.core.exceptions
import
PermissionDenied
from
django.http
import
Http404
from
django.utils.encoding
import
force_text
from
rest_framework
import
exceptions
,
serializers
from
rest_framework.compat
import
OrderedDict
from
rest_framework.request
import
clone_request
from
rest_framework.utils.field_mapping
import
ClassLookupDict
...
...
rest_framework/pagination.py
View file @
c4211ce7
...
...
@@ -7,7 +7,7 @@ from __future__ import unicode_literals
import
warnings
from
base64
import
b64decode
,
b64encode
from
collections
import
namedtuple
from
collections
import
OrderedDict
,
namedtuple
from
django.core.paginator
import
Paginator
as
DjangoPaginator
from
django.core.paginator
import
InvalidPage
...
...
@@ -16,7 +16,6 @@ from django.utils import six
from
django.utils.six.moves.urllib
import
parse
as
urlparse
from
django.utils.translation
import
ugettext_lazy
as
_
from
rest_framework.compat
import
OrderedDict
from
rest_framework.exceptions
import
NotFound
from
rest_framework.response
import
Response
from
rest_framework.settings
import
api_settings
...
...
rest_framework/relations.py
View file @
c4211ce7
# coding: utf-8
from
__future__
import
unicode_literals
from
collections
import
OrderedDict
from
django.core.exceptions
import
ImproperlyConfigured
,
ObjectDoesNotExist
from
django.core.urlresolvers
import
(
NoReverseMatch
,
Resolver404
,
get_script_prefix
,
resolve
...
...
@@ -12,7 +14,6 @@ from django.utils.encoding import smart_text
from
django.utils.six.moves.urllib
import
parse
as
urlparse
from
django.utils.translation
import
ugettext_lazy
as
_
from
rest_framework.compat
import
OrderedDict
from
rest_framework.fields
import
(
Field
,
empty
,
get_attribute
,
is_simple_callable
,
iter_options
)
...
...
rest_framework/routers.py
View file @
c4211ce7
...
...
@@ -16,14 +16,13 @@ For example, you might have a `urls.py` that looks something like this:
from
__future__
import
unicode_literals
import
itertools
from
collections
import
namedtuple
from
collections
import
OrderedDict
,
namedtuple
from
django.conf.urls
import
url
from
django.core.exceptions
import
ImproperlyConfigured
from
django.core.urlresolvers
import
NoReverseMatch
from
rest_framework
import
views
from
rest_framework.compat
import
OrderedDict
from
rest_framework.response
import
Response
from
rest_framework.reverse
import
reverse
from
rest_framework.urlpatterns
import
format_suffix_patterns
...
...
rest_framework/utils/model_meta.py
View file @
c4211ce7
...
...
@@ -6,14 +6,13 @@ relationships and their associated metadata.
Usage: `get_field_info(model)` returns a `FieldInfo` instance.
"""
import
inspect
from
collections
import
namedtuple
from
collections
import
OrderedDict
,
namedtuple
from
django.apps
import
apps
from
django.core.exceptions
import
ImproperlyConfigured
from
django.db
import
models
from
django.utils
import
six
from
rest_framework.compat
import
OrderedDict
,
get_model
FieldInfo
=
namedtuple
(
'FieldResult'
,
[
'pk'
,
# Model field instance
'fields'
,
# Dict of field name -> model field instance
...
...
@@ -45,7 +44,7 @@ def _resolve_model(obj):
"""
if
isinstance
(
obj
,
six
.
string_types
)
and
len
(
obj
.
split
(
'.'
))
==
2
:
app_name
,
model_name
=
obj
.
split
(
'.'
)
resolved_model
=
get_model
(
app_name
,
model_name
)
resolved_model
=
apps
.
get_model
(
app_name
,
model_name
)
if
resolved_model
is
None
:
msg
=
"Django did not return a model for {0}.{1}"
raise
ImproperlyConfigured
(
msg
.
format
(
app_name
,
model_name
))
...
...
rest_framework/utils/serializer_helpers.py
View file @
c4211ce7
from
__future__
import
unicode_literals
import
collections
from
collections
import
OrderedDict
from
django.utils.encoding
import
force_text
from
rest_framework.compat
import
OrderedDict
,
unicode_to_repr
from
rest_framework.compat
import
unicode_to_repr
class
ReturnDict
(
OrderedDict
):
...
...
tests/test_atomic_requests.py
View file @
c4211ce7
from
__future__
import
unicode_literals
import
unittest
from
django.conf.urls
import
url
from
django.db
import
connection
,
connections
,
transaction
from
django.http
import
Http404
...
...
@@ -7,7 +9,6 @@ from django.test import TestCase, TransactionTestCase
from
django.utils.decorators
import
method_decorator
from
rest_framework
import
status
from
rest_framework.compat
import
unittest
from
rest_framework.exceptions
import
APIException
from
rest_framework.response
import
Response
from
rest_framework.test
import
APIRequestFactory
...
...
tests/test_filters.py
View file @
c4211ce7
from
__future__
import
unicode_literals
import
datetime
import
unittest
from
decimal
import
Decimal
from
django.conf.urls
import
url
...
...
@@ -12,7 +13,7 @@ from django.utils.dateparse import parse_date
from
django.utils.six.moves
import
reload_module
from
rest_framework
import
filters
,
generics
,
serializers
,
status
from
rest_framework.compat
import
django_filters
,
unittest
from
rest_framework.compat
import
django_filters
from
rest_framework.test
import
APIRequestFactory
from
.models
import
BaseFilterableItem
,
BasicModel
,
FilterableItem
...
...
tests/test_model_serializer.py
View file @
c4211ce7
...
...
@@ -8,6 +8,7 @@ an appropriate set of serializer fields for each case.
from
__future__
import
unicode_literals
import
decimal
from
collections
import
OrderedDict
import
django
import
pytest
...
...
@@ -21,7 +22,7 @@ from django.utils import six
from
rest_framework
import
serializers
from
rest_framework.compat
import
DurationField
as
ModelDurationField
from
rest_framework.compat
import
OrderedDict
,
unicode_repr
from
rest_framework.compat
import
unicode_repr
def
dedent
(
blocktext
):
...
...
tests/test_permissions.py
View file @
c4211ce7
from
__future__
import
unicode_literals
import
base64
import
unittest
from
django.contrib.auth.models
import
Group
,
Permission
,
User
from
django.core.urlresolvers
import
ResolverMatch
...
...
@@ -11,7 +12,7 @@ from rest_framework import (
HTTP_HEADER_ENCODING
,
authentication
,
generics
,
permissions
,
serializers
,
status
)
from
rest_framework.compat
import
guardian
,
unittest
from
rest_framework.compat
import
guardian
from
rest_framework.filters
import
DjangoObjectPermissionsFilter
from
rest_framework.routers
import
DefaultRouter
from
rest_framework.test
import
APIRequestFactory
...
...
tests/test_relations_generic.py
View file @
c4211ce7
from
__future__
import
unicode_literals
from
django.contrib.contenttypes.fields
import
(
GenericForeignKey
,
GenericRelation
)
from
django.contrib.contenttypes.models
import
ContentType
from
django.db
import
models
from
django.test
import
TestCase
from
django.utils.encoding
import
python_2_unicode_compatible
from
rest_framework
import
serializers
from
rest_framework.compat
import
GenericForeignKey
,
GenericRelation
@python_2_unicode_compatible
...
...
tests/test_renderers.py
View file @
c4211ce7
...
...
@@ -3,7 +3,7 @@ from __future__ import unicode_literals
import
json
import
re
from
collections
import
MutableMapping
from
collections
import
MutableMapping
,
OrderedDict
from
django.conf.urls
import
include
,
url
from
django.core.cache
import
cache
...
...
@@ -13,7 +13,6 @@ from django.utils import six
from
django.utils.translation
import
ugettext_lazy
as
_
from
rest_framework
import
permissions
,
serializers
,
status
from
rest_framework.compat
import
OrderedDict
from
rest_framework.renderers
import
(
BaseRenderer
,
BrowsableAPIRenderer
,
HTMLFormRenderer
,
JSONRenderer
)
...
...
tests/test_utils.py
View file @
c4211ce7
...
...
@@ -150,16 +150,16 @@ class ResolveModelWithPatchedDjangoTests(TestCase):
def
setUp
(
self
):
"""Monkeypatch get_model."""
self
.
get_model
=
rest_framework
.
utils
.
model_meta
.
get_model
self
.
get_model
=
rest_framework
.
utils
.
model_meta
.
apps
.
get_model
def
get_model
(
app_label
,
model_name
):
return
None
rest_framework
.
utils
.
model_meta
.
get_model
=
get_model
rest_framework
.
utils
.
model_meta
.
apps
.
get_model
=
get_model
def
tearDown
(
self
):
"""Revert monkeypatching."""
rest_framework
.
utils
.
model_meta
.
model
s
.
get_model
=
self
.
get_model
rest_framework
.
utils
.
model_meta
.
app
s
.
get_model
=
self
.
get_model
def
test_blows_up_if_model_does_not_resolve
(
self
):
with
self
.
assertRaises
(
ImproperlyConfigured
):
...
...
tox.ini
View file @
c4211ce7
...
...
@@ -4,13 +4,11 @@ addopts=--tb=short
[tox]
envlist
=
py27-{lint,docs},
{py26,py27,py32,py33,py34}-django16,
{py27,py32,py33,py34}-django{17,18},
{py27,py34,py35}-django{master}
[testenv]
basepython
=
py26:
python2.6
py27:
python2.7
py32:
python3.2
py33:
python3.3
...
...
@@ -21,7 +19,6 @@ commands = ./runtests.py --fast {posargs} --coverage
setenv
=
PYTHONDONTWRITEBYTECODE
=
1
deps
=
django16:
Django
=
=1.6.3 # Should track minimum supported
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment