let's assume we have a endpoint /user/{user_id}/posts/{post_id}. I would like Django to be able to automatically parse URL and save model object connected to user_id and post_id, which I define.

In documentation I have found something like custom hyperlinked fields and method get_url. According to documentation:

The get_url method is used to map the object instance to its URL representation.


The get_object_from_url method is used to map URL representation to its object instance.