Django → Django - Tutorial 050. Creating Dynamic Site Settings Using SingletonModel
Django, SingletonModel, singleton, Model
Let's say you create a site with CMS based on Django, which must have some kind of dynamic site settings that will be available to the user. For example, the name of the site, some specialized information, while you take into account the possibility of multilingualism. What then can be used for this? I got the idea to use a database.
To implement this, the following is required:
- Creating a data model that will always contain only one object, that is, only one record. That is, it will be a Singleton Model.
- Prohibit deleting this entry and creating new ones in the Django admin panel
- The ability to use information from this model directly in the template, without loading the site settings in the view function.
Let's figure out in order how to implement this.
Donate
Hello, Dear Users of EVILEG!!!
If the site helped you, then support the development of the site financially, please.
You can do it by following ways:
- PayPal
- Yandex.Money
- Bitcoin: 13aqaPG8NZhX3By3he9LtrnHsmvRgsbt95
- Patreon - in Patreon I wrote my targets for reducing of advertisements on the site
Thank you, Evgenii Legotckoi