mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-24 23:19:47 +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)
|
||||
|
||||
if not hasattr(self, '_data'):
|
||||
if self.instance is not None and not getattr(self, '_errors', None):
|
||||
if not hasattr(self, '_data') and not getattr(self, '_errors', None):
|
||||
if self.instance is not None:
|
||||
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)
|
||||
else:
|
||||
self._data = self.get_initial()
|
||||
else:
|
||||
self._data = self.get_initial()
|
||||
return self._data
|
||||
|
||||
@property
|
||||
|
|
Loading…
Reference in New Issue
Block a user