I've tried this, which doesn't work:
if request.method == 'POST':
submitted_form = SomeForm(request.POST)
submitted_form.fields['missing_field']=some_value
if submitted_form.is_valid():
etc...
This returns an AttributeError: ' ' object has no attribute 'widget'.
That't a head scratcher for me.
On Sep 6, 6:55 pm, todbramble <[EMAIL PROTECTED]> wrote:
> After a form is submitted how do I add a value to a required attribute
> before I run form.is_valid()?
>
> What I have is:
>
> if request.method == 'POST':
> submitted_form = SomeForm(request.POST)
> if submitted_form.is_valid():
> etc...
>
> I want to add the missing fields to the submitted_form instance before
> the second 'if' so that it will pass validation. They are missing
> because their values are not available at the time the form is
> submitted.
>
> After much Googling I can't find how to do this. I must not be
> phrasing my question right because this must be quite common.
>
> Thanks. Tod
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---