Got it.
Thanks for the thorough explanation.

On 11/18/2014 06:52 PM, Collin Anderson wrote:
Philosopy-wise, I agree it would be good (and more secure) to error if the form detects that a field was not present in the html, however it's not possible to properly detect it in every case.

On Tuesday, November 18, 2014 12:39:03 PM UTC-5, Collin Anderson wrote:

    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
        <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 <mailto:django-developers+unsubscr...@googlegroups.com>. To post to this group, send email to django-developers@googlegroups.com <mailto: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/95623339-37d2-4736-8939-725cfaa70f31%40googlegroups.com <https://groups.google.com/d/msgid/django-developers/95623339-37d2-4736-8939-725cfaa70f31%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

--
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/546C4AD3.1040103%40arkade.info.
For more options, visit https://groups.google.com/d/optout.

Reply via email to