def obj_delete(self, **kwargs):
bundle = kwargs['bundle']
print("Object: %s" % (bundle.obj))
print("User: %s" % (bundle.request.user))
Hi Stodge,I had the same issue and I ended up using obj_get to get my object.Like this:
def obj_delete(self, **kwargs):
bundle = kwargs['bundle']
try:
bundle.obj = self.obj_get(bundle=bundle, **kwargs)
print("Object: %s" % (bundle.obj))
print("User: %s" % (bundle.request.user))
except ObjectDoesNotExist:
raise NotFound("A model instance matching the provided arguments could not be found.")
--
You received this message because you are subscribed to a topic in the Google Groups "Tastypie" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-tastypie/PsygVX9MIos/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-tastyp...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
As you can see here https://github.com/django-tastypie/django-tastypie/blob/master/tastypie/resources.py#L1474 , obj_delete seems to be a special case where Bundle is being manually built with only request provided.
obj_get seems to be performed later, in obj_delete ( https://github.com/django-tastypie/django-tastypie/blob/master/tastypie/resources.py#L2207 )
The problem is that if you invoke the parent obj_delete as you suggest, your object will not exist anymore :/