1
0
mirror of https://github.com/django/django.git synced 2024-12-23 01:25:58 +00:00

Fixed #2640 -- Allow is_required for CheckboxField classes (defaults to False,

which was the previous behaviour). Thanks, torbjornthorsen@gmail.com.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@3780 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick 2006-09-22 01:49:11 +00:00
parent 6be701eba1
commit c430eb8273

View File

@ -434,11 +434,11 @@ class HiddenField(FormField):
(self.get_id(), self.field_name, escape(data))
class CheckboxField(FormField):
def __init__(self, field_name, checked_by_default=False, validator_list=None):
def __init__(self, field_name, checked_by_default=False, validator_list=None, is_required=False):
if validator_list is None: validator_list = []
self.field_name = field_name
self.checked_by_default = checked_by_default
self.is_required = False # because the validator looks for these
self.is_required = is_required
self.validator_list = validator_list[:]
def render(self, data):