0

Am on Django 1.6

In my app I'd like to have a User object and a separate profile object. I'd like to avoid implementing a custom User object and instead just use a one-to-one relation to a model that has all the additional fields/info I want.

Whenever I do a query on a User object, 90% of the time I will want to retrieve this profile object. My thinking is that the best way to do this is to modify the get_queryset method of the default UserManager to always retrieve this related object via a "select_related" call.

Is there a way to do this?

Searching around this is the only resource i could find on the topic.
Override Django User Manager to only return active users in queries
Do I need to do it this way? Can I instead just somehow use the base User object?

Thanks in advance.

1
  • 1
    90% is still not 100%. Use select_related only when needed, not as default Commented Jan 10, 2014 at 7:52

1 Answer 1

2

Since Django 1.5 you can create your custom user model. This eliminates the need of user_profile.

Sign up to request clarification or add additional context in comments.

1 Comment

yes i'm aware of this. as it mentions in the docs in the "Model Design Considerations" - "Think carefully before handling information not directly related to authentication in your custom User Model..." I'm mainly concerned about possibly interferring with other apps. Is this concern unfounded?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.