Reputation: 2486
I am trying to do authorization in away that only owners of the objects can edit them.
How can i get the ids of the objects being edited in the post call in my authorization method?
Eg: If someone PUTs to the url /api/v1/resource_name/1
, I want to get '1'
Also, tastypie allows a collection of objects to be edited at one go. (http://django-tastypie.readthedocs.org/en/latest/interacting.html#updating-a-whole-collection-of-resources-put)
Is there a way for me to get a list of the objects being edited in any call?
Thanks!
Upvotes: 3
Views: 760
Reputation: 7751
I have been struggling with this as well. Right now, I determine the object by parsing request.path. I believe a more direct method (via the object parameter in Authorization() for example) will become available in 0.9.12 and beyond.
You might watch this question as well: How can I pass a detail object to custom authorization in tastypie?.
Good luck.
Upvotes: 1