@receiver(post_save, sender=CourseCreator)
def post_save_callback(sender, **kwargs):
 instance = kwargs['instance']
 if (instance.state != instance.orig_state):
  granted_state_change = ((instance.state == CourseCreator.GRANTED) or (instance.orig_state == CourseCreator.GRANTED))
  if granted_state_change:
   assert hasattr(instance, 'admin'), 'Must have stored staff user to change course creator group'
   update_creator_state.send(sender=sender, caller=instance.admin, user=instance.user, state=instance.state)
  if ((instance.state == CourseCreator.DENIED) or granted_state_change):
   send_user_notification.send(sender=sender, user=instance.user, state=instance.state)
  if (instance.state == CourseCreator.PENDING):
   send_admin_notification.send(sender=sender, user=instance.user)
  instance.state_changed = timezone.now()
  instance.orig_state = instance.state
  instance.save()

@ receiver ( post_save , sender = CourseCreator ) def post_save_callback ( sender , ** kwargs ) : instance = kwargs [ 'instance' ] if ( instance . state != instance . orig_state ) : granted_state_change = ( ( instance . state == CourseCreator . GRANTED ) or ( instance . orig_state == CourseCreator . GRANTED ) ) if granted_state_change : assert hasattr ( instance , 'admin' ) , 'Must have stored staff user to change course creator group' update_creator_state . send ( sender = sender , caller = instance . admin , user = instance . user , state = instance . state ) if ( ( instance . state == CourseCreator . DENIED ) or granted_state_change ) : send_user_notification . send ( sender = sender , user = instance . user , state = instance . state ) if ( instance . state == CourseCreator . PENDING ) : send_admin_notification . send ( sender = sender , user = instance . user ) instance . state_changed = timezone . now ( ) instance . orig_state = instance . state instance . save ( )
event changes to user preferences .