Skip to content

Instantly share code, notes, and snippets.

@rca
Created July 30, 2013 23:37
Show Gist options
  • Save rca/6118019 to your computer and use it in GitHub Desktop.
Save rca/6118019 to your computer and use it in GitHub Desktop.
A working post_save signal handler
class Repository(BaremetalModel):
account = models.ForeignKey('Account')
url = GitURIField()
def __unicode__(self):
return unicode(self.url)
def do_something(self):
pass
@classmethod
def post_save(cls, sender, instance, **kwargs):
instance.do_something()
models.signals.post_save.connect(Repository.post_save, sender=Repository)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment