2012-07-19 109 views

回答

3

我使用userena。但我相信,它的外觀幾乎一樣;)

class UserProfile(UserenaBaseProfile): 

     user = models.OneToOneField(User, unique=True) 
     city = models.CharField(max_length=32, blank=True, null=True) 

在settings.py:

AUTH_PROFILE_MODULE = 'accounts.UserProfile' 
3

請參閱該文檔Storing additional information about users,做一個模型,用OneToOneField關係User

from django.contrib.auth.models import User 

class UserProfile(models.Model): 
    # This field is required. 
    user = models.OneToOneField(User) 

    # Other fields here 
    accepted_eula = models.BooleanField() 
    favorite_animal = models.CharField(max_length=20, default="Dragons.")