mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-25 23:50:01 +03:00
Remove redundant double getattr check
This commit is contained in:
parent
1142ee5fc1
commit
2486dbf791
|
@ -250,13 +250,13 @@ class BaseSerializer(Field):
|
||||||
)
|
)
|
||||||
raise AssertionError(msg)
|
raise AssertionError(msg)
|
||||||
|
|
||||||
if not hasattr(self, '_data'):
|
if not hasattr(self, '_data') and not getattr(self, '_errors', None):
|
||||||
if self.instance is not None and not getattr(self, '_errors', None):
|
if self.instance is not None:
|
||||||
self._data = self.to_representation(self.instance)
|
self._data = self.to_representation(self.instance)
|
||||||
elif hasattr(self, '_validated_data') and not getattr(self, '_errors', None):
|
elif hasattr(self, '_validated_data'):
|
||||||
self._data = self.to_representation(self.validated_data)
|
self._data = self.to_representation(self.validated_data)
|
||||||
else:
|
else:
|
||||||
self._data = self.get_initial()
|
self._data = self.get_initial()
|
||||||
return self._data
|
return self._data
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
Loading…
Reference in New Issue
Block a user