I find myself doing this a lot in view code if request.method == 'GET': form = MyForm(initial=data) return render_to_response('template.html', RequestContext(request, { 'foo': foo, 'bar': bar }))
elif request.method == 'POST': form = MyForm(request.POST) if form.is_valid(): # make new model object and save else: # same as the GET method code to display errors The issue is that if the form validation fails, I end up using the same code to display the page. Is there a better way? I could put the template render in a function, but I'm not sure how much that would save. What do the rest of you do? Thanks, Mike --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---