Hello fellow Java user,

If I would do it, I'd setup a model to store those configurations.

Then on the app, upon login or upon loading the initial page of the app, I 
will perform the operation to retrieve the details from the database, and 
then dump to the django sessions object.

# get operation
request.session.get('key', None)


# set operation
self.request.session['key'] = value

Please also see https://docs.djangoproject.com/en/2.2/topics/http/sessions/ for 
more information.

Regards,
Simon.

On Wednesday, May 22, 2019 at 9:26:15 PM UTC+8, Jean-Noël Colin wrote:
>
> Hi, 
>
> I'm coming from a java world, where there exists different scopes for 
> objects: application-, session-, request scopes all define different 
> lifecycle for objects. I have some difficulties in finding an equivalent 
> approach in Django. 
>
> Here's the need: my project stores its custom configuration in the 
> database, for persistence; these parameters can be changed by an 
> administrator only, through a custom view/form. However, those parameters 
> are used in many views in the project, in read-only mode. So my idea would 
> be to have one single object, that stores the parameter values, that is 
> initialized when the application starts, that can be read at any time 
> without requiring reading from the DB, and that, when modified by admin, 
> would be saved to the db. How to plug this in the django architecture? 
>
> Thanks a lot
>
> Jean-Noël
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/da5dd8d8-e1a3-44cc-8f44-158f4183a99e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to