Skip to content

Instantly share code, notes, and snippets.

@bencleary
Last active December 4, 2017 22:37
Show Gist options
  • Save bencleary/1b4f1aeff0312e166400f2e495d95e04 to your computer and use it in GitHub Desktop.
Save bencleary/1b4f1aeff0312e166400f2e495d95e04 to your computer and use it in GitHub Desktop.
from django.dispatch import receiver
from django.db.models.signals import post_save
from .models import *
@receiver(post_save, sender=MyCustomUser)
def build_profile_on_user_creation(sender, instance, created, **kwargs):
if created:
profile = MyProfile(user=instance)
profile.save()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment