Questions tagged [django-sessions]

For questions related to Django's session mechanism.

Django provides full support for anonymous sessions. The session framework lets you store and retrieve arbitrary data on a per-site-visitor basis. It stores data on the server side and abstracts the sending and receiving of cookies. Cookies contain a session ID – not the data itself (unless you’re using the cookie based backend or a custom backend).

Reference: https://docs.djangoproject.com/en/stable/topics/http/sessions/

490 questions
0
votes
0 answers

How to clear entry in Django session

I have a search form that I use to then list the objects with a paginated ListView. For the pagination to work, I need to keep the form fields in the list view, which I did so far using session. In the view of the form, I want to clear the values of…
Chris
  • 1
  • 1
  • 4
0
votes
0 answers

How to create a session extra when login through django admin?

In a view I can do the following: request.session ["mysession"] = mysession. But I do not want to use a view, I want to create my session during login with the admin of django. Obviously, without overwriting the framework of django Is this…
0
votes
1 answer

How to add a function hook for expiration of a session in django?

I want a function be executed every time a session has expired. Like, recording people viewing specific web page, when user session timeout, decrease the count.
dspjm
  • 5,473
  • 6
  • 41
  • 62
0
votes
1 answer

Queries over ManyToManyField with variable set in a sessions user

Here is my models: class Clients(models.Model): client_name = models.CharField(max_lenght=100) commentaire_clients = models.TextField(blank=False) date_demande = models.TimeField(auto_now_add=True) choix =…
Tony
  • 394
  • 4
  • 14
0
votes
1 answer

Persist session data Django

i need to migrate session data to the another table in database at the time of its destruction (for example, when the browser is closed or when expired date). I read that session doesn't clear itself , i need do it manualy .
privaloff
  • 66
  • 4
0
votes
1 answer

Changing a visitor permission using Django Sessions

I have a Django application with a number of polls. There is no option to register on my website as a user. I want to allow a visitor to vote on a specific poll only once every seven days. This is how I am changing the visitor permission in my…
Unknown Coder
  • 783
  • 3
  • 12
  • 23
0
votes
1 answer

Using Django session outside of view

My Django application does not have user logins. Anyone can access the application and vote on different lists of songs. What I want is that when a user votes, the user should not be allowed to vote again in that list. Here is my AJAX…
Unknown Coder
  • 783
  • 3
  • 12
  • 23
0
votes
1 answer

store a list in request.session in one view and retrieve it in another view django

I have a huge list that will be generated dynamically from a csv file in a django view, but i had a requirement to use that list in the next view, so i thought to give a try on django sessions def import_products(request): if request.method ==…
Shiva Krishna Bavandla
  • 25,548
  • 75
  • 193
  • 313
0
votes
1 answer

Gather POST data in Django, store to session and then redirect to the original page

I'm looking to build a webpage based around a changing homepage. It's going to have the user answer questions, with their answers being stored as part of their session (don't want to have to have the user log in). I'd then like to be able to access…
Kali_89
  • 617
  • 2
  • 7
  • 21
0
votes
1 answer

Django request.GET to display value of form field

Is there a way that i can access the values in my form fields before submitting the form. I need to store the value of one of my fields in request.session[] so as to access it later ( in the same view). I tried doing it using request.GET but it…
Akshay
  • 329
  • 1
  • 7
  • 19
0
votes
0 answers

Django request.session does not resolve

I have a ManyToMany relation between 2 of my models in the same app. This looks like following: class Event(models.Model): eventID = models.CharField(deafult = random_eventID) signal = models.ManyToManyField(Signal) .... .... Now,…
Akshay
  • 329
  • 1
  • 7
  • 19
0
votes
1 answer

How to handle Django sessions properly

I have the following requirements: Users must be able to see (and log out) their other sessions. Sessions must expire BOTH at browser close and after a perioid of inactivity. default database can not be used to store sessions. My current approach…
Kimvais
  • 38,306
  • 16
  • 108
  • 142
0
votes
1 answer

Using django SessionStore without knowing key

I'm writing a django app that requires an object to be somewhat persistent, at least for the purposes of a session. It is not view-based, so I'm looking at SessionStore as the place to create, then retrieve it from. However, SessionStore requires a…
askvictor
  • 3,621
  • 4
  • 32
  • 45
0
votes
1 answer

Different ways for sending request context with HttpResponseRedirect in django

I have a django app and implemented payment gateway functionality. Now what i was trying is After successful transation, need to do redirect user to another page that shows the response details so i am using HttpresponseRedirect to redirect the…
0
votes
2 answers

Using ClassBasedViews I want to retrieve records from my database in Django based on the user's email, which is stored in a session

For the past 2hrs i've been trying to accomplish the following in Django 1.5: I want to retrieve records from my database based on the user's email, which is stored in a session. Here are my ideal algorithms: In my function based view: 1. Attempt…