Sending an email can be faulty, I would use a logger and write the stacktrace Also, is it possible that something other than you django application it's agreeing the database? On Feb 3, 2014 10:32 PM, "heidi" <dcrag...@gmail.com> wrote:
> I have a web game in which an alliance can have multiple members. This is > represented by a foreign key field on each member's class (seeing as a > member can only be part of one alliance). > > I've been getting weird instances of worlds and alliances being deleted. I > narrowed it down to where I was sure the worlds were getting deleted only > because the alliances were, so I removed the cascade deletion. However, I > still cannot figure out for the life of me *why* the alliances are being > deleted in the first place. > > I overrode the custom delete method like so: > class Alliance(models.Model): > ... > def delete(self, *args, **kwargs): > mail.send_mail('Alliance Deletion', '%s has been deleted.' \ > % self.alliance_name, 'f...@email.com', ['t...@email.com']) > super(Alliance, self).delete(*args, **kwargs) > > > However, at least one alliance has been deleted where I did not get an > email sent to me. I gather this is because I must be calling delete() from > a QuerySet, but I have been over my code with a fine-toothed comb and there > is precisely one occasion where I call delete() on any alliance instance, > and it's not over a QuerySet. > > Is there a way to track down what is causing this, or to find out what > function has executed the delete of an object? > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/e1ee2b07-6685-41e0-a7c4-9b45cd1eba84%40googlegroups.com > . > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFWa6tJBoDS5pvLONorYaUTdPS_7fwPTksaXR9hPo5%2BDUPL_iw%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.