9
votes

I would like have additional settings tied to each user in my application (beyond, is_staff, is_admin etc etc). Basically I'd like to have different settings to customize their user experience (ie: don't show tooltips, how many rows to display in results tables, other flags for turning things on or off).

Are there best practices for adding these types of settings, or example model to do this without touching the django user object (in the past when i needed a quick user property, i just added it to my django source code, but obviously know that this is a horrible idea).

So when someone sucessfully logs in, I would grab the settings for the user and add them to the session.

I wasn't sure if there was a pretty way, or best practice for doing this.

2
This is a duplicate. All of these are the similar questions: stackoverflow.com/search?q=%5Bdjango%5D+profile - S.Lott
i see that now, but without knowing it was a user profile (hence why i called it user settings) i could not have thought to search for that. and now that people have answered this, I can no longer delete the post - MattoTodd
I found this question while searching them wrong terms also. So this question helped me - Scott Warren

2 Answers

4
votes

As already said, use UserProfile. To store many flags in the same field there's django-bitfield.

0
votes

Either put them in the user profile model, or create another model with a one-to-one to User.