Hi, I have a simple scenario using Django 0.96 and am looking for a cleaner solution than what I currently have:
I want to include a simple submission form (a few simple fields) on most pages of my site. I have the form action set to '.' so that validation can be done in place and errors displayed to the user. I am currently checking for the POST and either handling it or creating a new form in each of these views and then passing the form to each of my templates, e.g. def example_page(request): if request.method == 'POST': form = SubmitMeForm(request.POST) if form.is_valid(): # do your thing return HttpResponseRedirect('/done/') else: form = SubmitMeForm() variables = RequestContext(request, { 'submitMeForm': form, }) return render_to_response('somePage.html', variables) I have 2 issues with this: 1 - I have to include this code in each and every view that represents a page that has this template. There has to be a simpler way of doing it. 2 - What if one of these pages has another Django form in it? I now have to handle the fact that the POST could have resulted from this form OR the other one. How would I do that? TIA -- delino --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---