mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-04-16 07:02:10 +03:00
Fix One field that is required=False, allow_null=True and not provided. to_representation should not explicitly set it to None
This commit is contained in:
parent
ccfe0a9637
commit
b0ca35ea55
|
@ -450,10 +450,10 @@ class Field:
|
|||
except (KeyError, AttributeError) as exc:
|
||||
if self.default is not empty:
|
||||
return self.get_default()
|
||||
if self.allow_null:
|
||||
return None
|
||||
if not self.required:
|
||||
raise SkipField()
|
||||
if self.allow_null:
|
||||
return None
|
||||
msg = (
|
||||
'Got {exc_type} when attempting to get a value for field '
|
||||
'`{field}` on serializer `{serializer}`.\nThe serializer '
|
||||
|
|
Loading…
Reference in New Issue
Block a user