Created
January 30, 2013 11:49
-
-
Save bsnux/4672788 to your computer and use it in GitHub Desktop.
Revisions
-
Arturo Fernandez created this gist
Jan 30, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ import pickle # Session key key = 'my_qs' # Pizza => model example qs = Pizza.objects.filter(ingredient='tomato') # Dumping data request.session[key] = pickle.dumps(qs.query) # Loading data pizzas = Pizza.objects.all()[:1] pizzas.query = pickle.loads(request.session[key]) # Using qs for pizza in pizzas: print(pizza.ingredient)