Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 19b3062

Browse files
Allow SerializerMethodResourceRelatedField to be list
1 parent 1623942 commit 19b3062

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

‎rest_framework_json_api/relations.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ def get_choices(self, cutoff=None):
171171
])
172172

173173

174-
175174
class SerializerMethodResourceRelatedField(ResourceRelatedField):
176175
"""
177176
Allows us to use serializer method RelatedFields
@@ -211,7 +210,7 @@ def get_attribute(self, instance):
211210
return super(SerializerMethodResourceRelatedField, self).get_attribute(instance)
212211

213212
def to_representation(self, value):
214-
if isinstance(value, QuerySet):
213+
if isinstance(value, list):
215214
base = super(SerializerMethodResourceRelatedField, self)
216215
return [base.to_representation(x) for x in value]
217216
return super(SerializerMethodResourceRelatedField, self).to_representation(value)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /