Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

modeling user settings in django

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.

like image 790
MattoTodd Avatar asked Apr 26 '11 22:04

MattoTodd


1 Answers

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

like image 91
vad Avatar answered Oct 27 '22 22:10

vad