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 f038050 commit d014754Copy full SHA for d014754
ckc/fields.py
@@ -16,4 +16,9 @@ def use_pk_only_optimization(self):
16
return False
17
18
def to_representation(self, value):
19
- return self.read_serializer(value, context=self.context).data
+ # Are we on the browsable API? if so, just return pk!
20
+ if self.context['request'].META["HTTP_ACCEPT"].startswith("text/html"):
21
+ return value.pk
22
+ else:
23
+ # Normal request, return full item read details
24
+ return self.read_serializer(value, context=self.context).data
0 commit comments