Hi,

My form has 2 fields. One charfield, and the other is a charfield with
a multiline widget. The form displays fine.

When I submit it with data it correctly redirects to /success/ however
if I submit the form with a field not filled in it tells me that
views.index didn't return an HttpResponse object.

I suspect I am not handling errors correctly. Can anyone give me a
nudge in the right direction please ?

Thank you


def index(request):
    if request.method == 'POST':
        form = pasteForm(request.POST)
        if form.is_valid():
            name = form.cleaned_data['name']
            log = form.cleaned_data['log']
            return HttpResponseRedirect('/success/')
        else:
            form.errors
            form = pasteForm()
    else:
        form = pasteForm()
        return render_to_response('pastebin.html', {'form': form})
--~--~---------~--~----~------------~-------~--~----~
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