Tuesday, February 9, 2010

Extending Django user model

Right so using the nifty Django user model is easy but how do i create a foreign key reference?

First use:
from django.contrib.auth.models import User

This gives access to the user model. Then just use the user as you would a normal foreign key reference
user_fk = models.ForeignKey(User)

No comments:

Post a Comment