Extending the User model with custom fields in Django

Posted by Gaurav on Stack Overflow See other posts from Stack Overflow or by Gaurav
Published on 2010-05-22T07:40:25Z Indexed on 2010/05/22 9:40 UTC
Read the original article Hit count: 287

Filed under:
|
|

I am trying to extend the User model so that I can add my own custom fields but I keep getting an error stating:

'NoneType' object has no attribute '_default_manager'

whenever I try to use

user.get_profile()

to add values to the custom field i.e. whenever I use it like so:

user = User.objects.create_user(username, email, password)

user.first_name = fname

user.last_name = lname

user.save()

uinfo = user.get_profile()

uinfo.timezone = "Asia/Pune"

uinfo.save()

I have already followed the steps given at http://stackoverflow.com/questions/44109/extending-the-user-model-with-custom-fields-in-django/965883#965883 with no luck.

© Stack Overflow or respective owner

Related posts about django

Related posts about django-models