Created
July 30, 2013 23:37
-
-
Save rca/6118019 to your computer and use it in GitHub Desktop.
A working post_save signal handler
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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