Sunday, November 24, 2013

Re: Form cleaned_data

On Sun, Nov 24, 2013 at 4:38 PM, Daniel Roseman <daniel@roseman.org.uk> 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?

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?

Thanks,
Tim



> 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+unsubscribe@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/d0ad9a93-ffbf-4439-a06a-270c965cfb6a%40googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.



--
MLHIM VIP Signup: http://goo.gl/22B0U
============================================
Timothy Cook, MSc +55 21 94711995
MLHIM http://www.mlhim.org
Like Us on FB: https://www.facebook.com/mlhim2
Circle us on G+: http://goo.gl/44EV5
Google Scholar: http://goo.gl/MMZ1o
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook

--
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+unsubscribe@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/CA%2B%3DOU3XpKaumgVELGac%3DL4xoOTJFM%3DyN0ruk7V4A1jdfwTPVCA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment