blob: 5aac62318dbfd0407ffd3ded8ca3cbc226e4d3b2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
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(user=instance)
user_profile.save()
|