Is there a way to check a condition on sender model before processing a command. My code
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)