On Sunday, 24 November 2013 18:46:21 UTC, Timothy W. Cook wrote:
>
> On Sun, Nov 24, 2013 at 4:38 PM, Daniel Roseman 
> <dan...@roseman.org.uk<javascript:>> 
> wrote: 
> > Hmm, I tried to post an answer to your original question earlier but it 
> never appeared. 
> > 
>
> Thanks Daniel.  Your help is very much appreciated. 
>
> > The reason why adding the values to `cleaned_data` doesn't work is that 
> those fields aren't in the `fields` list for the form in the first place, 
> so it doesn't know to do anything with them. Adding them to the uncommitted 
> model instance is the correct solution. 
> > -- 
>
> I guess I was thinking that cleaned_data is a dictionary sent to the 
> ORM for commit? 
>

Well, not really, it only takes account of those fields that are in 
Meta.fields (and not in Meta.exclude).
 

> Now, what is confusing is why saving the 'form' instance to another 
> (in this case 'f') instance without a commit and adding the values to 
> the new instance makes a difference.  Isn't 'f' just a copy of 'form'? 
>
> Any clarification?
>

No, `f` is now an unsaved instance of the Review model, rather than a form 
(you should probably make that clearer by calling the instance `r` or 
`review`). So you can modify it like you would any other model instance 
before calling save() - and of course this is the normal model save(), not 
the form's.
--
DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/19f4bd73-c632-40b1-8d80-700fa433e929%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to