mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-01-24 00:04:16 +03:00
Merge pull request #474 from justanotherbody/master
Add support for "true" and "false" as BooleanField values
This commit is contained in:
commit
bd530a2ee4
|
@ -693,9 +693,9 @@ class BooleanField(WritableField):
|
||||||
default = False
|
default = False
|
||||||
|
|
||||||
def from_native(self, value):
|
def from_native(self, value):
|
||||||
if value in ('t', 'True', '1'):
|
if value in ('true', 't', 'True', '1'):
|
||||||
return True
|
return True
|
||||||
if value in ('f', 'False', '0'):
|
if value in ('false', 'f', 'False', '0'):
|
||||||
return False
|
return False
|
||||||
return bool(value)
|
return bool(value)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user