Skip to content

Commit

Permalink
BooleanField에 allow_null이 True인 경우 관련 버그 수정
Browse files Browse the repository at this point in the history
관련 PR: encode#8614
  • Loading branch information
ml-taehoon-choi committed May 12, 2023
1 parent 2da473c commit 22b8ff7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions rest_framework/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,12 @@ class BooleanField(Field):
}
NULL_VALUES = {'null', 'Null', 'NULL', '', None}

def __init__(self, **kwargs):
if kwargs.get('allow_null', False):
self.default_empty_html = None
self.initial = None
super().__init__(**kwargs)

def to_internal_value(self, data):
try:
if data in self.TRUE_VALUES:
Expand Down

0 comments on commit 22b8ff7

Please sign in to comment.