user_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/-/NsRz1xo-3-kJ.
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