I'm not sure that I've understood you completely. What condition are you going to apply to a signal?
Best regards,
Kirill Yakovenko
On Wednesday, January 2, 2013 4:34:35 PM UTC+7, ysfjwd wrote:
-- On Wednesday, January 2, 2013 4:34:35 PM UTC+7, ysfjwd wrote:
Is there a way to check a condition on sender model before processing a command. My codeuser_logged_in.connect(update_last_login) def create_activation_code(sender, instance, created, **kwargs):print 'The signal is called'if created:print 'the singal goes to created'if not instance.is_active:print 'the signal evaluates the active state'activation = Activation.objects.create(user=instance) activation.get_code()activation.save()else:print 'the signal fails to evaluate active state'signals.post_save.connect(create_activation_code, sender=User) can conditions be applied on signals?//ysfjwd
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/Mlo0g69piH4J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment