On Sat, May 10, 2008 at 3:22 AM, Greg <[EMAIL PROTECTED]> wrote:
>
> Hello,
> This view did work. However, I just did a 'svn up' and now I believe
> the new queryset-refactor is causing my code not to work. Below is my
> view:
>
> ///
>
> def tracking(request):
> if request.POST:
> for b in request.session['tracking']:
> if request.POST.get(str(b.id)) != "":
> try:
> b.tracking = request.POST.get(str(b.id))
> b.order_status = 3
> b.send_email="Tracking"
> b.save()
> except:
> pass
> a = Order.objects.filter(order_status=2)
> request.session['tracking'] = a
> return render_to_response('tracking.htm', {'entries': a})
>
> ///
>
> My error occurs when I try to set a session variable called 'tracking'
> to my QuerySet "a". Another post said I need to convert my QuerySet
> to a list. However, I'm not sure how to do that and also I wouldn't
> have access to the list when the form was posted.
>
> Any help would be appreciated!
>
request.session['tracking'] = list(a)
would convert your QuerySet to a list before storing it in the session. I
don't understand your comment about not having access to it then -- it's
still stored in the session, just now it is a list, not a QuerySet.
Karen
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---