We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1aa6d39 commit f9c4fdfCopy full SHA for f9c4fdf
rest_framework_json_api/serializers.py
@@ -0,0 +1,15 @@
1
+from rest_framework.serializers import HyperlinkedModelSerializer
2
+
3
+from rest_framework_json_api.relations import JSONAPIRelatedField
4
5
6
+class JSONAPIModelSerializer(HyperlinkedModelSerializer):
7
+ """
8
+ A type of `ModelSerializer` that uses hyperlinked relationships instead
9
+ of primary key relationships. Specifically:
10
11
+ * A 'url' field is included instead of the 'id' field.
12
+ * Relationships to other instances are hyperlinks, instead of primary keys.
13
+ * Uses django-rest-framework-json-api JSONAPIRelatedField instead of the default HyperlinkedRelatedField
14
15
+ serializer_related_field = JSONAPIRelatedField
0 commit comments