How to set serializer field without showing it to end user in DRF?
I have url like “doc/<int:doc_id>/price/” for get
and post
and “doc/<int:doc_id>/price/<int:id>” for delete
and patch
or retrieve
.
How serializer field can be set without showing it to enduser in DRF?
I have url like doc/<int:doc_id>/price/ for get and post and doc/<int:doc_id>/price/<int:id> for delete and patch or retrieve. My problem is, when creating a new price I want to set price.doc_id=self.kwargs[‘doc_id’] but at the same time I want that serializer field to be hidden in swagger documentation(I use drf-spectacular). The end-user should not be aware of that field.