Opened 3 years ago

Closed 3 years ago

#17317 closed Uncategorized (invalid)

lists stored in session becomes not changed (by pop() or del) in next request

Reported by: oddghost@… Owned by: nobody
Component: Generic views Version: 1.2
Severity: Normal Keywords: pop session
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

i stored small list in session

	v = Tests.objects.values_list('number', flat=True).filter(test=test,ticket=nomera).order_by('number')
	request.session['tests-cards'] = list(v)

and want to obtain one element per request.

this don`t write session:

def get_next(request):
	card=request.session['tests-cards'].pop(0) 
...

and this so:

def get_next(request):
	card=request.session['tests-cards'][0]
	del request.session['tests-cards'][0]
...

this works:

def get_next(request):
	card=request.session['tests-cards'].pop(0)
	request.session['tests-cards']=request.session['tests-cards']
...

bug or not?

Change History (1)

comment:1 in reply to: ↑ description Changed 3 years ago by ramiro

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

Replying to oddghost@…:

bug or not?

No, please read documentation first.

Note: See TracTickets for help on using tickets.
Back to Top