bia-fitness/profile/apps.py

19 lines
473 B
Python
Raw Normal View History

2015-04-06 22:35:51 +00:00
from django.apps import AppConfig
from django.dispatch import receiver
from django.db.models.signals import post_save
from django.contrib.auth.models import User
def create_profile(sender, created, instance, **kwargs):
from .models import Profile
if created:
Profile.objects.create(user=instance)
class ProfileConfig(AppConfig):
name = 'profile'
app_label = 'profile'
def ready(self):
post_save.connect(create_profile, sender=User)