Coverage for apps/users/signals.py: 50%
8 statements
« prev ^ index » next coverage.py v6.4.4, created at 2024-04-19 09:45 -0600
« prev ^ index » next coverage.py v6.4.4, created at 2024-04-19 09:45 -0600
1from django.db.models import signals
2from django.dispatch import receiver
4from .models import User
7@receiver(signals.post_save, sender=User)
8def set_user_username(sender, instance: User, created, *args, **kwargs):
9 if created:
10 instance.username = instance.email
11 instance.save()