I need to pass instance id after last / of my @action name method, and I seriously have no idea how...
I have a UserViewSet, which url to access list is : /users/, then i have action called favorite_posts, which is detail=False because I'm filtering by current logged user, and the action refer to user posts, I wanna be able to pass the post_id like /users/favorite_posts/post_id/, because in this case it's more friendly to me than /users/1/favorite_posts/ which I could obtain setting detail=True.
Is there any way to do that?
/posts/<id>/
? Otherwise you have two paths to the same resource. And I'd suggest to invent something like '/home/' root url for obtaining anything related to current user./users/
+/users/<id>/
resulting with anything else then list of users and user by id produce ambiguity and misunderstanding of common rest approaches.favorite_posts
list with post ids, now you want to reach specific post by id. Post is a separate entity which is expected to be discovered at/posts/<id>/
.