Ok, now my python newbness is going to show...
I figured out what was causing it. (but I don't know why it wasn't working
before)
I can do the following:
request.session['question_list'].append(question.id)
but not:
request.session['question_list'] = request.session['question_list'].append(
quest
I just realized that if the above was the case, you probably wouldn't
be getting the NoneType error, but the original list with one element.
Did you check your session contents to make sure the data was in
actually in there? If the new item was there in the session, perhaps
it was your if statem
What about setting session variable to None, then setting it back to a
new list object with the questions in it, just to see if it's a
problem with it not realizing that the list has been modified?
I don't think this is the best solution either, but would be a good
test to see if it's just not re
Thanks for responding, I should have mentioned previously that I did
try putting 'SESSION_SAVE_EVERY_REQUEST=True' in my settings file but
that didn't work. Now that I read your e-mail, I also tried setting
request.session.modified = True right after my append but that didn't
work either.
I meant
You might want to try adding:
request.session.modified = True ( or modify your settings file to save
every request by setting the SESSION_SAVE_EVERY_REQUEST to True )
Because from this note from Django Session docs:
# Session is modified.
request.session['foo'] = {}
# Gotcha: Session is NOT modi
Ok, I upgraded to the development version of django and that didn't
help. I then started to try and trim out the code so it was of a more
manageable size to post here. It's still rather large but if it helps
anyone visualize what I'm talking about, here it is:
## test_indexs.html
Take the Test
I am building an online test taking type of application and I am
having an issue with one of my session variables...
The code looks something like this: (A lot removed for brevity)
The first time around I do the following to initialize the list:
question = Question.objects.order_
7 matches
Mail list logo