Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#1767 closed defect (fixed)

[patch] validator_list silently deleted for BooleanFields

Reported by: jkocherhans Owned by: adrian
Component: Validators Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Line 257 of django/db/models/fields/__init__.py explicitly deletes the validator_list and is_required parameters for BooleanFields. The frustrating part is that no errors are raised by providing a validator_list argument to a BooleanField, and I can't find any doumentation for this behavior. I understand and agree with not allowing is_required, but I have a use case for allowing validator_list. Is there any particular reason it's being deleted? (Other than that it often times simply doesn't have a value... the particular validator should deal with that by checking for a KeyError IMHO) Regardless though, silently deleting the attribute without an error or at least a warning is not very nice ;-)

Attachments (2)

boolean_validator_list.diff (1.6 KB) - added by jkocherhans 9 years ago.
allows validator_list for boolean fields
boolean_validator_list2.patch (1.6 KB) - added by Alex Dedul 9 years ago.
Added mutable default arguments fix

Download all attachments as: .zip

Change History (5)

Changed 9 years ago by jkocherhans

allows validator_list for boolean fields

comment:1 Changed 9 years ago by jkocherhans

  • Summary changed from validator_list silently deleted for BooleanFields to [patch] validator_list silently deleted for BooleanFields

comment:2 Changed 9 years ago by ubernostrum

#2314 was a duplicate of this one.

Changed 9 years ago by Alex Dedul

Added mutable default arguments fix

comment:3 Changed 9 years ago by jacob

  • Resolution set to fixed
  • Status changed from new to closed

(In [3467]) Fixed #1767 -- boolean fields may now have validators! Thanks, Joseph.

Note: See TracTickets for help on using tickets.
Back to Top