Opened 13 years ago

Closed 12 years ago

#2815 closed defect (invalid)

problem with custom validator and boolean fields

Reported by: simondav@… Owned by: Adrian Holovaty
Component: Validators Version: 0.95
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


I have model with a boolean field, and a custom validator is defined in the validator_list parameter.

he validator has to run
whenever the form is submitted, whether the checkbox is ticked or not.
I have set the 'always_test' parameter to true for the validator, but
the validator still only gets called when the box is ticked. I have
found that the 'always_test' parameter works fine for other types of
field, it just appears to be a problem with booleanfields. Relevant
sections of the model are pasted below:

class Order(models.Model):

def stor_all(field_data, new_data):

..validator code goes here

stor_all.always_test = True

storage_all = models.BooleanField('All to be delivered to

storage?', null='true', validator_list = [stor_all])

Change History (3)

comment:1 Changed 12 years ago by Simon G. <dev@…>

Resolution: invalid
Status: newclosed

Can you confirm if this is still a problem on a current checkout?

comment:2 Changed 12 years ago by Gary Wilson

Resolution: invalid
Status: closedreopened

I don't think we should close tickets just because they haven't been confirmed. We could end up closing a bunch of valid tickets that way.

comment:3 Changed 12 years ago by Simon G. <dev@…>

Resolution: invalid
Status: reopenedclosed

The submitter emailed me and confirmed that this had been a mistake on his part, and not a bug in Django.

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