Hello,

The way <input type="checkbox"> works in html forms, there's no distinction 
between "unchecked" and "form field not present". The browser won't even 
send an empty key for the the checkbox at all if it's not checked. 
Therefore, if the django form has a BooleanField and doesn't see a key in 
the data for it, then it needs to assume a false value.

The "data" argument on a django form is expected to be fairly raw browser 
data.

You may either want to create the fields on the form dynamically based on 
what keys are present in your data, or dynamically remove the non-existent 
fields from form.fields in __init__ once you have the data.

Collin


On Tuesday, November 18, 2014 12:21:38 PM UTC-5, aRkadeFR wrote:
>
> Hello everyone, 
>
> Sorry to bother cause I did a ticket and got an answer by Tim Graham. 
> https://code.djangoproject.com/ticket/23760 
>
> But I wonder what's the philosophy of the Django developers community on 
> this ticket. 
> If Tim Graham want to be more explicit here, I would be really happy to 
> read from all of you. 
>
>  From my point of view, in many case it's not a developer error, it can 
> be a template problem, a 
> generation of the data not updated before handled to the form __init__ 
> problem, or so much 
> more. 
>
> Plus, it's not "new django developer" friendly. 
>
> If the object created, even though there's missing fields in the form, 
> can created the object 
> attribute with the default one, it would be much more friendly. 
>
> Thank you 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/0efc5dd3-01e8-4a9e-8fc1-8335d70b45a9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to