1. simplecodes
  2. Untitled project
  3. wtforms
  4. Pull requests

Pull requests

#45 Declined
Repository
marconijr
Branch
default
Repository
simplecodes
Branch
default

added filter when processing BooleanField instead of assuming that an empty field won't be submitted

Author
  1. Marconi Moreto
Reviewers
Description

Its not safe to assume that an unchecked field won't be submitted, when using via ajax (ie. Backbone model's .save) sometimes its better to include the falsy field. So to be safe, we filter valuelist instead and check if we can find a truthy value then cast to bool from there.

  • Learn about pull requests

Comments (2)

  1. James Crasta

    We've flipped on this a few times, and ended with the current behavior after some thinking.

    Actually I think it'd be best if this was an option to BooleanField somehow.

  2. Marconi Moreto author

    If its going to be an option, now developer needs to make sure the field declaration and form submission matches and if I did not specify an option to BooleanField and I have 2 ways to post data, one which submits empty and which doesn't; now the form will only work on one case.