In my API, sometimes you make HTTP request with id of objects (like update preferred address you put the id of your new default address).
I retrieve it like this:
address = get_object_or_404(
Address.objects.filter(...),
pk=request.data['address_pk']
)
This is completely functional, however it doesn't feel as the best way. I tried to search for the best practice, however I was not able to find proper search term which would satisfy my curiosity.
Is this way of getting a model instance from a request a good practice? Or should it be avoided?