Hi everyone,

I have a feedback form which needs to be functional across 3 different
actions within the same view...

My actions are:
    references_list
    reference_detail
    thanks

Here's my current form processing code:

if request.method == 'POST':
        form = SuggestionForm(request.POST)

        if form.is_valid():
            first_name = form.cleaned_data['first_name']
            last_name = form.cleaned_data['last_name']
            email = form.cleaned_data['email']
            reference_name = form.cleaned_data['reference_name']
            url = form.cleaned_data['url']

            subject = 'Your suggestion has been received.'
            message = "Thank you for suggesting %s to us. We'll review
your suggestion and get back to you as quickly as possible." %
(reference_name)

            send_mail(subject, message, email,
'[EMAIL PROTECTED]')
            request.session['first_name'] = first_name
            return HttpResponseRedirect('/articles-and-books/thanks/')
    else:
        form = SuggestionForm()


How can I structure this such that I don't have to repeat myself in
each action of the view?

TIA,
Brandon
--~--~---------~--~----~------------~-------~--~----~
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