Apostolos
Apostolos

Reputation: 8121

Preferences and settings in a Django Project

I want to add to my django project the ability a user to set his own settings, and Django should remember that when the user logins. I also want my project to have some global settings that will be the same for every user. E.g before a user logs in the system the will be a language set for every user.(global setting) but after the user is authenticated django will switch to his prefered language. What is the best approach for that? My thought was settings file for the global settings (language, locale etc) and a settings application for user-specific preferances. The user-specific preferances might have to do with very simple but specific staff like colors of appearence of things etc. Is creating a settings app the right approach? No code just need a point to right direction first before implementing

Upvotes: 0

Views: 299

Answers (2)

user1301404
user1301404

Reputation:

Edit: I thought first you want to generate the Django settings based on the admins, I didn't read your question completely.

Anyway for user specific settings and preferences, definitely use a database. None use files for such tasks, you can query a database and create all your fields easily using Django's ORM.

Upvotes: 1

Paulo Bu
Paulo Bu

Reputation: 29804

IMHO if the settings depends on user preferences I think a database is the way to store them, not files. Settings files are inherent to project's settings and database storage (normally) is the one who should persist dynamic user preferences.

Upvotes: 1

Related Questions