It seems that bundle.obj is not populated during authorization of create_detail.
In addition, create_detail for the user really does not make much sense, because there is no object for the user who will own until it is created in any case. You can simply check if bundle.request.user is a valid user with model permissions.
In my case, I needed to check if the created object was referencing an object belonging to the user, so here is what I came up with:
def create_detail(self, object_list, bundle): resource=BookResource() book=resource.get_via_uri(bundle.data["book"], bundle.request) return book.user == bundle.request.user
Anyway, bottom line: tastypie docs don't work a bit.
And hopefully this will help.
source share