def handle_user_sign_up(sender, instance: settings.AUTH_USER_MODEL, created, **kwargs): if created: add_user_to_group(instance, 'common_users') set_user_for_subscriber(instance) Profile.objects.create(user=instance) instance.save()
def save_user(self, user: settings.AUTH_USER_MODEL, *args, **kwargs) -> settings.AUTH_USER_MODEL: """ Hook to add custom logic around saving a user. Return the saved user instance. """ is_new_instance = user.pk is None user.save() if is_new_instance: logger.debug('New user created') else: logger.debug('User %s updated with incoming attributes', user) return user