You don't need to "call" form second time:

        pForm = PersonForm(request.POST.copy(), instance=p)

And pForm is the ready to use instance of form.


On Fri, Jan 23, 2009 at 8:29 AM, waltbrad <[email protected]> wrote:

>
> Hi folks. PersonForm is a modelform.  I'm trying to validate data by
> calling an instance of PersonForm.  (This is from Sam's 24 hour, and
> I've modified the example to accommodate the 1.0 changes.)  So,
>
> if request.method == 'POST':
>     if request.POST['submit'] == 'update':
>          message = 'Update Request for %s.' % p.name
>          pForm = PersonForm(instance=p)
>          c=pForm(request.POST.copy())
>
> And I get the error alluded to in the Subject line.  The author has
> something similar:
>
> if request.method == 'POST':
>     if request.POST['submit'] == 'update':
>          message = 'Update Request for %s.' % p.name
>          PersonForm = forms.form_for_instance(p)
>          f = PersonForm(request.POST.copy())
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
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