|
return self.model_class.objects.get(pk=pk) |
There is no way to change the queryset used for fetching the related input field but to subclass the class and replace all of to_internal_value.
Vanilla DRF provides a queryset parameter for related fields to do the mentioned. Checkout:
https://github.com/encode/django-rest-framework/blob/master/rest_framework/relations.py#L243-L260
django-rest-framework-json-api/rest_framework_json_api/serializers.py
Line 64 in 5e2f60d
There is no way to change the queryset used for fetching the related input field but to subclass the class and replace all of
to_internal_value.Vanilla DRF provides a
querysetparameter for related fields to do the mentioned. Checkout:https://github.com/encode/django-rest-framework/blob/master/rest_framework/relations.py#L243-L260