Ticket #23547: 0001-fix-BooleanField-in-case-when-field-is-required-and-.patch

File 0001-fix-BooleanField-in-case-when-field-is-required-and-.patch, 918 bytes (added by Lagovas, 10 years ago)

Patch for ticket

  • django/forms/fields.py

    From 0a58d227716e14c047ee428feeb0ce53bca44c89 Mon Sep 17 00:00:00 2001
    From: Lagovas <lagovas.lagovas@gmail.com>
    Date: Wed, 24 Sep 2014 10:46:37 +0300
    Subject: [PATCH] fix BooleanField in case when field is required and has value
     False (always raised ValidationError)
    
    ---
     django/forms/fields.py | 3 +--
     1 file changed, 1 insertion(+), 2 deletions(-)
    
    diff --git a/django/forms/fields.py b/django/forms/fields.py
    index 966b303..314ed2e 100644
    a b class BooleanField(Field):  
    703703        return super(BooleanField, self).to_python(value)
    704704
    705705    def validate(self, value):
    706         if not value and self.required:
    707             raise ValidationError(self.error_messages['required'], code='required')
     706        pass
    708707
    709708    def _has_changed(self, initial, data):
    710709        # Sometimes data or initial could be None or '' which should be the
Back to Top