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 use different session id for same user across different django project with same database

I have 2 Django projects running on different domains. Both are using the same database and the same models. One project is in 2.7 and another project is in 3.7. When user login into one domain, it logs out the user from other domain. I have login…
0
votes
1 answer

Extend number of characters used by Django SessionStore from 32 to 64

Django==1.11.17, Python==3.6.7 I would like to extend the number of characters used for the session key. Looking in django.contrib.sessions.backends.base.py: class SessionBase(object): ... def _get_new_session_key(self): "Returns…
camelBack
  • 748
  • 2
  • 11
  • 30
0
votes
1 answer

Django request session cannot read the django-session table

I have two simple views, one is log in and the other one is just checking the session. I added user_id into the request.session and it did create a new entry in the django_session table. But when I try to get the request session in a new request. It…
Chao Sun
  • 3
  • 1
0
votes
1 answer

Using Django sessions

i have got some problem on implementing Django sessions. I have an employee listing page with a filter option on it. Filtering is done based on the fields and a text entered in a text box. The users filtered is displayed in the filter.html page;…
rv_k
  • 2,383
  • 7
  • 39
  • 52
0
votes
1 answer

Remove session data in database-backed session in django after clearing browser history

After i clear my browser history the session key and data that was added to the table django_session (session engine is database-backed by mysql) for the session remains and for subsequent requests a new 'session key' is added. In a situation where…
zahlen
  • 73
  • 2
  • 11
0
votes
1 answer

Django add to cart and cart view error

I get a 'NoneType' object is not iterable error when I add 1 object to the cart via the scan_to_cart view and want to add a second object. Also I get the same error when I want to view my cart when there are actually objects in it. I could not find…
sandermander
  • 73
  • 11
0
votes
1 answer

How django sessions work

I am new to django i made a registration page and login page now i want a user registered to login to my website when a user is logged in i want to associate a session for user which only dies when he logs out or he closes the browser now whenever…
identicon
  • 61
  • 1
  • 6
0
votes
1 answer

Problems with sessionid expired django

I have a django app, and the autheticate user use the cookies, i set de cookie age with de value 36000 SESSION_COOKIE_AGE = 36000 # In Google Chrome the cookie sessionid set the expired date 1969-12-31T23:59:59.000Z The app logout in 3 minutes, in…
0
votes
2 answers

Django sessions: can you check for session data and set it in same view?

When using Django sessions, is it good practice to see if session data has been previously set, and if not to set the initial session data, in the same view? Will this cause major issues, for me or users, if users have their cookies disabled? (The…
Jon Cox
  • 10,622
  • 22
  • 78
  • 123
0
votes
1 answer

django - sessions not save for some reason when I go back to the same page using a link

In one of my views I'm saving a few sessions like this: def myview(request): request.session['session_1'] = 'value1 request.session['session_2'] = 'value2' Then on the same view function and also other views found on other applications I'm…
avatar
  • 12,087
  • 17
  • 66
  • 82
0
votes
1 answer

Django: detect the mouse click if session out

I have created a login page for my application and set the session out for 3 minutes and it is working fine, but the problem is when session out happened the user is still able to do many activities on the current page i.e the logout page do not…
bSr
  • 1,410
  • 3
  • 16
  • 30
0
votes
1 answer

Can I get cookies value or session value inside the has_permission method of django rest framework?

I am working on a project where i have to check the user whether they belong the company or not.i am already put check while login user. how i can use company id inside the has_permission() method? class…
0
votes
0 answers

getting a lot of TransactionManagementError in production servers

Lately getting a lot of errors likes this: An error occurred in the current transaction. You can't " TransactionManagementError: An error occurred in the current transaction. You can't execute queries until the end of the 'atomic' block. the…
Uri Lazar
  • 21
  • 3
0
votes
1 answer

Django: How to trigger a session 'save' of form data when clicking a non-submit link

I know if want you to store form information to the session during a submit you do it with the 'def post' in your view. However, I can not figure out how to store form information when a random link e.g. 'homepage'. How would you go about storing…
TheSadPrinter
  • 359
  • 1
  • 4
  • 15
0
votes
1 answer

Session Hijacking in Django 1.7.7 and python3

I have developed a small application for submitting some data to database server(Oracle 11g). When we are reviewing security of this small application, we observed as follows: 1. We have deployed django with https and all secure configurations like…
Galaxy
  • 743
  • 1
  • 8
  • 26