Re: Swappable sessions

2020-04-18 Thread Lorenzo Peña
Fair enough, Tim. Thanks for answering! El miércoles, 15 de abril de 2020, 18:29:24 (UTC-4), Tim Graham escribió: > > I don't see a strong argument for adding it. As far as I can tell, this > would require adding 'request' to the signature of SessionStore.__init___() > (so it could be stored as

Re: Swappable sessions

2020-04-15 Thread Tim Graham
I don't see a strong argument for adding it. As far as I can tell, this would require adding 'request' to the signature of SessionStore.__init___() (so it could be stored as an attribute on SessionStore and thereby available in create_model_instance()). Backwards compatibility would be non-triv

Re: Swappable sessions

2020-04-15 Thread Lorenzo Peña
Yes, of course. I am already working things around in order to get what I need. Now, the database backed SessionStore defines a method "create_model_instance(self, data)" which is called from "django.contrib.sessions.middleware.SessionMiddleware". Django docs invite to redefine this method in

Re: Swappable sessions

2020-04-15 Thread Lorenzo Peña
Yes, of course. I am already working things around in order to get what I need. Now, the database backed SessionStore defines a method "create_model_instance(self, data)" which is called from "django.contrib.sessions.middleware.SessionMiddleware". Django docs invite to redefine this method in orde

Re: Swappable sessions

2020-04-15 Thread Tim Graham
Can't you copy whatever data you want from the request into the session data (request.session. = request.) in a view, middleware, or wherever? That seems like the proper separation of concerns. On Wednesday, April 15, 2020 at 11:50:13 AM UTC-4, Lorenzo Peña wrote: > > Now, in order to follow the

Re: Swappable sessions

2020-04-15 Thread Lorenzo Peña
Now, in order to follow the path suggested in the Django documentation for overriding database backed sessions, some of the data one might need to store in the session model is coming from the request, and Django is not passing the request when instantiating the session store. Do you think ther

Re: Swappable sessions

2020-04-14 Thread Lorenzo Peña
Thanks Adam, looks like the link you posted covers it all. -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-develope

Re: Swappable sessions

2020-04-14 Thread Adam Johnson
Hi Lorenzo Using a different Session model is already supported - see the docs: https://docs.djangoproject.com/en/3.0/topics/http/sessions/#extending-database-backed-session-engines . Or is there something beyond that which you wanted? Thanks, Adam P.S. Please don't start your message addressed

Swappable sessions

2020-04-14 Thread Lorenzo Peña
Hello fellows! Has there ever been any discussion about making the Session model from django.contrib.sessions a swappable model? Sometimes it's required to enhance the session model in order to track more information. There are alternatives like django-user-sessions, but replacing the contrib s