Created
October 20, 2013 02:33
-
-
Save zenweasel/7064220 to your computer and use it in GitHub Desktop.
A Signal Receiver template
This file contains 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
from django.db.models.signals import post_save | |
from django.dispatch import receiver | |
@receiver(post_save, sender=ShortLink) | |
def shortlink_save_handler(sender, **kwargs): | |
instance = kwargs['instance'] | |
created = kwargs.get('created', False) | |
shortlink = ShortLink.objects.get(pk=instance.pk_shortlink) | |
shortlink_shoveler = ShovelShortlink() | |
shortlink_shoveler.update_one(shortlink, created) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment