bia-fitness/profiles/apps.py

19 lines
475 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):
2015-04-07 19:04:40 +00:00
name = 'profiles'
app_label = 'profiles'
2015-04-06 22:35:51 +00:00
def ready(self):
post_save.connect(create_profile, sender=User)