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
5f8d353f
Commit
5f8d353f
authored
May 18, 2013
by
Tom Christie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename has_user_through_model -> has_through_model
parent
e1a3cab4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
rest_framework/serializers.py
+6
-6
No files found.
rest_framework/serializers.py
View file @
5f8d353f
...
@@ -591,7 +591,7 @@ class ModelSerializer(Serializer):
...
@@ -591,7 +591,7 @@ class ModelSerializer(Serializer):
forward_rels
+=
[
field
for
field
in
opts
.
many_to_many
if
field
.
serialize
]
forward_rels
+=
[
field
for
field
in
opts
.
many_to_many
if
field
.
serialize
]
for
model_field
in
forward_rels
:
for
model_field
in
forward_rels
:
has_
user_
through_model
=
False
has_through_model
=
False
if
model_field
.
rel
:
if
model_field
.
rel
:
to_many
=
isinstance
(
model_field
,
to_many
=
isinstance
(
model_field
,
...
@@ -599,7 +599,7 @@ class ModelSerializer(Serializer):
...
@@ -599,7 +599,7 @@ class ModelSerializer(Serializer):
related_model
=
model_field
.
rel
.
to
related_model
=
model_field
.
rel
.
to
if
to_many
and
not
model_field
.
rel
.
through
.
_meta
.
auto_created
:
if
to_many
and
not
model_field
.
rel
.
through
.
_meta
.
auto_created
:
has_
user_
through_model
=
True
has_through_model
=
True
if
model_field
.
rel
and
nested
:
if
model_field
.
rel
and
nested
:
if
len
(
inspect
.
getargspec
(
self
.
get_nested_field
)
.
args
)
==
2
:
if
len
(
inspect
.
getargspec
(
self
.
get_nested_field
)
.
args
)
==
2
:
...
@@ -629,7 +629,7 @@ class ModelSerializer(Serializer):
...
@@ -629,7 +629,7 @@ class ModelSerializer(Serializer):
field
=
self
.
get_field
(
model_field
)
field
=
self
.
get_field
(
model_field
)
if
field
:
if
field
:
if
has_
user_
through_model
:
if
has_through_model
:
field
.
read_only
=
True
field
.
read_only
=
True
ret
[
model_field
.
name
]
=
field
ret
[
model_field
.
name
]
=
field
...
@@ -649,12 +649,12 @@ class ModelSerializer(Serializer):
...
@@ -649,12 +649,12 @@ class ModelSerializer(Serializer):
continue
continue
related_model
=
relation
.
model
related_model
=
relation
.
model
to_many
=
relation
.
field
.
rel
.
multiple
to_many
=
relation
.
field
.
rel
.
multiple
has_
user_
through_model
=
False
has_through_model
=
False
is_m2m
=
isinstance
(
relation
.
field
,
is_m2m
=
isinstance
(
relation
.
field
,
models
.
fields
.
related
.
ManyToManyField
)
models
.
fields
.
related
.
ManyToManyField
)
if
is_m2m
and
not
relation
.
field
.
rel
.
through
.
_meta
.
auto_created
:
if
is_m2m
and
not
relation
.
field
.
rel
.
through
.
_meta
.
auto_created
:
has_
user_
through_model
=
True
has_through_model
=
True
if
nested
:
if
nested
:
field
=
self
.
get_nested_field
(
None
,
related_model
,
to_many
)
field
=
self
.
get_nested_field
(
None
,
related_model
,
to_many
)
...
@@ -662,7 +662,7 @@ class ModelSerializer(Serializer):
...
@@ -662,7 +662,7 @@ class ModelSerializer(Serializer):
field
=
self
.
get_related_field
(
None
,
related_model
,
to_many
)
field
=
self
.
get_related_field
(
None
,
related_model
,
to_many
)
if
field
:
if
field
:
if
has_
user_
through_model
:
if
has_through_model
:
field
.
read_only
=
True
field
.
read_only
=
True
ret
[
accessor_name
]
=
field
ret
[
accessor_name
]
=
field
...
...
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