Skip to content

Instantly share code, notes, and snippets.

@loic
Created September 21, 2013 09:43
Show Gist options
  • Save loic/6648972 to your computer and use it in GitHub Desktop.
Save loic/6648972 to your computer and use it in GitHub Desktop.
# Django doesn't fire signals for parent Models.
# https://code.djangoproject.com/ticket/9318
def _save_table(self, raw=False, cls=None, force_insert=False,
force_update=False, using=None, update_fields=None):
if cls is not self.__class__:
signals.pre_save.send(sender=cls, instance=self,
raw=raw, using=using, update_fields=update_fields)
updated = super(Node, self)._save_table(raw, cls, force_insert,
force_update, using, update_fields)
if cls is not self.__class__:
signals.post_save.send(sender=cls, instance=self, created=(not updated),
raw=raw, using=using, update_fields=update_fields)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment