Answers for "request.session django for edit data"

2

how store list in django session

if not 'saved' in request.session or not request.session['saved']:
		request.session['saved'] = [obj]
	else:
		saved_list = request.session['saved']
		saved_list.append(obj)
		request.session['saved'] = saved_list
Posted by: Guest on September-22-2020
0

django flush sessions on server startup

#!/bin/sh

# clear django_session table
DJANGO_SETTINGS_MODULE="myproj.settings" 
  python -c 'from django.contrib.sessions.models import Session; 
    Session.objects.all().delete()' 
python manage.py runserver
Posted by: Guest on February-12-2020

Python Answers by Framework

Browse Popular Code Answers by Language