mirror of
https://github.com/django/django.git
synced 2025-10-27 23:56:08 +00:00
[1.10.x] Fixed #27039 -- Fixed empty data fallback to model field default in model forms.
Backport of 4bc6b93994 from master
This commit is contained in:
@@ -480,6 +480,10 @@ def boolean_check(v):
|
||||
|
||||
|
||||
class CheckboxInput(Widget):
|
||||
# Don't use model field defaults for fields that aren't in POST data,
|
||||
# because checkboxes don't appear in POST data if not checked.
|
||||
dont_use_model_field_default_for_empty_data = True
|
||||
|
||||
def __init__(self, attrs=None, check_test=None):
|
||||
super(CheckboxInput, self).__init__(attrs)
|
||||
# check_test is a callable that takes a value and returns True
|
||||
|
||||
Reference in New Issue
Block a user