Signal to Create Profile After User Signup

A snippet showing how to create profiles automatically with signals.


from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.dispatch import receiver
from .models import Profile

@receiver(post_save, sender=User)
def create_profile(sender, instance, created, **kwargs):
    if created:
        Profile.objects.create(user=instance)
      
Explanation:
  • A post_save signal is triggered after a new User is created.
  • Automatically creates a Profile whenever a new User is registered.
    • Category Signals
    • Total Views 615
    • Last Modified 15 May, 2026
    • Tags #signals #user #profile #post_save
    Never miss a story on Django.wiki

    Subscribe for fresh tutorials, snippets, and updates.

    By subscribing you agree to our Privacy Policy.