11 lines
332 B
Python
11 lines
332 B
Python
from django.contrib.auth.models import User
|
|
from django.db.models.signals import post_save
|
|
from django.dispatch import receiver
|
|
|
|
from .models import Agent
|
|
|
|
|
|
@receiver(post_save, sender=User)
|
|
def create_profile(sender, instance, created, **kwargs):
|
|
if created:
|
|
Agent.objects.create(name=instance.username, user=instance)
|