I got it figured out. It wasn't anything to do with my session code at
all. It was my own fault, not matching the "thanks" view correctly.

I'm still getting used to matching routes with RegExes, but now I know
what to do next time.

Thanks,
Brandon

On Apr 30, 7:48 pm, Brandon Taylor <[EMAIL PROTECTED]> wrote:
> Hi Karen,
>
> Ok, I have verified that the session cookie is being set using the
> WebDeveloper toolbar in Firefox, and I set up an "error" page to
> redirect to if the cookie wasn't set. All that worked as intended.
>
> So, my next stupid question is...how do I get the value of the cookie
> back out to the template, if it's not the way outlined in the
> documentation...?
>
> TIA,
> Brandon
>
> On Apr 30, 3:30 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
>
> > On Wed, Apr 30, 2008 at 3:40 PM, Brandon Taylor <[EMAIL PROTECTED]>
> > wrote:
>
> > > Hello everyone,
>
> > > I must be missing the forest for the trees, because I simply can't see
> > > what I'm doing wrong here!
>
> > > #in views.py
> > > def find_seminar_occurrence(request, slug, id):
> > >    occurrence = get_object_or_404(Occurrence, pk=id)
> > >    other_occurrences =
> > > Occurrence.objects.filter(seminar=occurrence.seminar).exclude(pk=id)
>
> > >    ContactForm = form_for_model(Contact)
>
> > >    if request.method == 'POST':
> > >        form = ContactForm(request.POST)
> > >        if form.is_valid():
> > >            first_name = form.cleaned_data['first_name']
> > >            last_name = form.cleaned_data['last_name']
> > >            phone = form.cleaned_data['phone']
> > >            email = form.cleaned_data['email']
> > >            seminar = form.cleaned_data['seminar']
> > >            form.save()
>
> > >            request.session['first_name'] = first_name
> > >            request.session['seminar'] = occurrence.seminar
> > >            request.session.modified = True
> > >            return HttpResponseRedirect('thanks/')
> > >    else:
> > >        form = ContactForm()
>
> > >    return render_to_response('seminar_detail.html', locals())
>
> > > def thanks(request):
> > >    first_name = request.session['first_name']
> > >    seminar = request.session['seminar']
>
> > >    return render_to_response('thanks.html', {'first_name' :
> > > first_name})
>
> > > #in thanks.html
> > > {{ first_name }}
>
> > > If I do a print first_name in my 'thanks' function, it is empty. What,
> > > oh please someone tell me, am I doing wrong?!
>
> > Nothing jumps out at me.  If you put a request.session.set_test_cookie() in
> > your code where you set a session variable, what does
> > request.session.test_cookie_worked() return i your thanks function?
>
> > Karen
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to