Skip to content

Commit 827c41f

Browse files
author
Leifur Halldor Asgeirsson
committed
correction: SerialierMethodResourceRelatedField
the new field is SerializerMethodResourceRelatedField, not SerializerMethodResourceField
1 parent 93d7aeb commit 827c41f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

‎example/serializers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def __init__(self, *args, **kwargs):
2626

2727
comments = relations.ResourceRelatedField(
2828
source='comment_set', many=True, read_only=True)
29-
suggested = relations.SerializerMethodResourceField(
29+
suggested = relations.SerializerMethodResourceRelatedField(
3030
source='get_suggested', model=Entry, read_only=True)
3131

3232
def get_suggested(self, obj):

‎rest_framework_json_api/relations.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def choices(self):
142142
])
143143

144144

145-
class SerializerMethodResourceField(ResourceRelatedField):
145+
class SerializerMethodResourceRelatedField(ResourceRelatedField):
146146
def get_attribute(self, instance):
147147
# check for a source fn defined on the serializer instead of the model
148148
if self.source and hasattr(self.parent, self.source):

0 commit comments

Comments
 (0)