1) self.instance.delete()
2) MyModel.objects.get(pk=self.instance.pk).delete()
I'm listening the post_delete of self.instance class, in there I
create a "dependency graph" of their related objects. The problem is
that at some point I'm retriveing self.instance like:
MyRelatedModel.self_instance_related_name and with the first (1)
delete method I can still access to self.instance but with the second
(2) delete method i'm getting a DoesNotExist.
Why it's different?
Thanks!
--
Marc
Hi Daniel,
thanks for your answer!
mmm, but deleting like
MyModel.objects.get(pk=self.instance.pk).delete() self.instance will
continue exist too, isn't it?
Maybe it could be something related with db transactions?
--
Marc
I give it a second thought and I think that you were absolutely right
Danniel. In (1) the post_save is called with a new object that no
longer exists when post_save is called and with (2) is called with
self.instance that still exists after post_save. Thanks and sorry for
not catching it at the first time.
thanks again :)
--
Marc