mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-04 20:40:14 +03:00
Added validation exceptions for required fields with allow_blank set to True to mirror Django's validation logic
This commit is contained in:
parent
5ee472718a
commit
5fc253d886
|
@ -290,7 +290,7 @@ class Field(object):
|
||||||
if data is empty:
|
if data is empty:
|
||||||
if getattr(self.root, 'partial', False):
|
if getattr(self.root, 'partial', False):
|
||||||
raise SkipField()
|
raise SkipField()
|
||||||
if self.required:
|
if self.required and not self.allow_blank:
|
||||||
self.fail('required')
|
self.fail('required')
|
||||||
return self.get_default()
|
return self.get_default()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user