1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # -*- coding: utf-8 -*-
from django.contrib.auth.models import User
from django.db import models
class UserProfile(models.Model):
''' Special User for Ionyse '''
user = models.ForeignKey(User, unique=True)
def createUserProfile(sender, instance, **kwargs):
""" Create a UserProfile object each time a User is created ; and
link it.
"""
UserProfile.objects.get_or_create(user=instance)
models.signals.post_save.connect(createUserProfile, sender=User)
|
More like this
- create_model_instances management command by Lacrymology 3 months, 4 weeks ago
- Improved User Admin by gregb 3 years ago
- Alternative to User.get_profile() by jpwatts 5 years, 2 months ago
- convenience parent class for UserProfile model by willhardy 4 years ago
- Effective content caching for mass-load site using redirect feature by nnseva 1 year, 10 months ago
Comments