Skip to content

Instantly share code, notes, and snippets.

@saiday
Created August 10, 2019 16:17
Show Gist options
  • Save saiday/f9e306b0ba5d73d7601ab8e4f3cc65ed to your computer and use it in GitHub Desktop.
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)
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