Hi guys,

I've hunted around the docs and googled this (it's quite a niche
scenario so a bit hard to find!) and I'm still a bit stuck! I was
hoping somebody might be able to help out!

Can anyone tell me how to pre-fill form data without the form
automatically calling submit on the form so that the validation
messages don't appear in the rendered template?

Here's the view code:

..
if request.POST:
    form = MyForm(request.POST)
    if form.is_valid():
        do_stuff()
else:
    form = MyForm({'field_1': field_data_1, 'field_2':
field_data_2, ... })
return ...
..

Basically I want to pre-populate MyForm with the data listed in the
dictionary above, but it always calls the submit method when I load
the template! I'm stuck... :-)

Thanks for any help you can provide,

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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to