Saturday, August 14, 2010

Where can I save a variable to be used between calls to a Django view?

Programmer Question

I am looking to return a random number between 0 and 4 in a Django view, which is repeatedly called. The number is limited in that it can't be the same as the number that was called previously. It would be fine if the number loops rather than being random, it just can't be the same as what was returned before.



I tried using a variable outside of the view, and incrementing it within the function, but that wouldn't save between each call to the view.



I hope that explanation works, I am brand new to Django.



Find the answer here

No comments:

Post a Comment

LinkWithin

Related Posts with Thumbnails