diff options
author | lxf <sng@luxagraf.net> | 2022-05-14 16:38:07 -0400 |
---|---|---|
committer | lxf <sng@luxagraf.net> | 2022-05-14 16:38:07 -0400 |
commit | bb3973ffb714c932e9ec6dd6a751228dc71fe1d3 (patch) | |
tree | 6fa32f9392ad2ec32271349b86a4c1388fd6ba95 /app/accounts/signals.py |
initial commit
Diffstat (limited to 'app/accounts/signals.py')
-rw-r--r-- | app/accounts/signals.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/app/accounts/signals.py b/app/accounts/signals.py new file mode 100644 index 0000000..837a7ed --- /dev/null +++ b/app/accounts/signals.py @@ -0,0 +1,12 @@ +from django.db.models.signals import post_save +from django.dispatch import receiver + +from .models import User, UserProfile + + +@receiver(post_save, sender=User) +def create_profile(sender, update_fields, created, instance, **kwargs): + """ creates a blank profile when a new user signs up """ + if created: + user_profile = UserProfile.objects.create(user=instance) + user_profile.save() |