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
4ebd701b
Commit
4ebd701b
authored
Sep 28, 2012
by
Tom Christie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix serialization issue with Django 1.3
parent
25cbff5f
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
5 deletions
+14
-5
rest_framework/compat.py
+8
-0
rest_framework/serializers.py
+2
-1
tox.ini
+4
-4
No files found.
rest_framework/compat.py
View file @
4ebd701b
...
...
@@ -10,6 +10,14 @@ except ImportError:
import
StringIO
def
get_concrete_model
(
model_cls
):
try
:
return
model_cls
.
_meta
.
concrete_model
except
AttributeError
:
# 1.3 does not include concrete model
return
model_cls
# First implementation of Django class-based views did not include head method
# in base View class - https://code.djangoproject.com/ticket/15668
if
django
.
VERSION
>=
(
1
,
4
):
...
...
rest_framework/serializers.py
View file @
4ebd701b
...
...
@@ -4,6 +4,7 @@ import types
from
decimal
import
Decimal
from
django.core.serializers.base
import
DeserializedObject
from
django.utils.datastructures
import
SortedDict
from
rest_framework.compat
import
get_concrete_model
from
rest_framework.fields
import
*
...
...
@@ -299,7 +300,7 @@ class ModelSerializer(RelatedField, Serializer):
else
:
cls
=
self
.
opts
.
model
opts
=
cls
.
_meta
.
concrete_model
.
_meta
opts
=
get_concrete_model
(
cls
)
.
_meta
pk_field
=
opts
.
pk
while
pk_field
.
rel
:
pk_field
=
pk_field
.
rel
.
to
.
_meta
.
pk
...
...
tox.ini
View file @
4ebd701b
...
...
@@ -11,11 +11,11 @@ deps = https://github.com/django/django/zipball/master
[testenv:py2.7-django1.4]
basepython
=
python2.7
deps
=
django
>
=1.4.1
deps
=
django
=
=1.4.1
[testenv:py2.7-django1.3]
basepython
=
python2.7
deps
=
django
>=1.3.2
deps
=
django
==1.3.3
[testenv:py2.6-django1.5]
basepython
=
python2.6
...
...
@@ -23,8 +23,8 @@ deps = https://github.com/django/django/zipball/master
[testenv:py2.6-django1.4]
basepython
=
python2.6
deps
=
django
>
=1.4.1
deps
=
django
=
=1.4.1
[testenv:py2.6-django1.3]
basepython
=
python2.6
deps
=
django
>=1.3.2
deps
=
django
==1.3.3
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