#2640 closed defect (fixed)
[patch] django.forms.CheckboxField should be able to use is_required
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | Validators | Version: | dev |
Severity: | normal | Keywords: | Manipulator Validator Checkbox |
Cc: | torbjornthorsen@… | Triage Stage: | Unreviewed |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
There is currently no way of using the is_required attribut for a CheckboxField.
Use case:
In some forms it is usual practice to but confirmation checkboxes that users must check (aknowleding EULA and such) before a form is considered complete. In my mind ValidationError should be raised for FormWrapper when this is not the case.
Notes:
The current version of CheckboxField takes a validator_list, which may be useful, but these are only called when the checkbox is visible in request.POST, ie. when the user has checked the checkbox.
What is needed for the use case is a boolean validator to run even if checkbox is not visible in request.POST.
html2python: I did some testing, and html2python is only called if the checkbox has been checked, and as the checkbox widget is a boolean, I choose to just return true, as a situation where one would return false will not arise.
Attachments (1)
Change History (3)
by , 18 years ago
Attachment: | checkboxfield.patch added |
---|
comment:1 by , 18 years ago
Summary: | django.forms.CheckboxField should be able to use is_required → [patch] django.forms.CheckboxField should be able to use is_required |
---|
comment:2 by , 18 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Patch for using is_required on CheckboxField