Created
August 10, 2019 16:17
-
-
Save saiday/f9e306b0ba5d73d7601ab8e4f3cc65ed to your computer and use it in GitHub Desktop.
edited create profile signals (from: https://www.youtube.com/watch?v=FdVuKt_iuSI)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib.auth.models import User | |
from django.db.models.signals import post_save | |
from django.dispatch import receiver | |
from users.models import Profile | |
@receiver(post_save, sender=User) | |
def create_profile(sender, instance, created, **kwargs): | |
if created: | |
Profile.objects.create(user=instance) | |
instance.profile.save() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment