Tastypie can automatically generate urlpattern for simple resource urls.
For example, /user/1/
, /group/2/
, I only need to define UserResource and GroupResource
But what if I have API url like /group/2/user/
, saying I want to retrieve all users in group 2.
Does tastypie have any solution to handle this?
You can use the
tastypie.Resource.prepend_urls
method:I usually create a shortcut method that those long, ugly urls:
Which makes the
prepend_urls
method look like this: