mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-26 19:43:59 +03:00
Minor cleanup
This commit is contained in:
parent
5250700659
commit
d048d32876
|
@ -306,11 +306,7 @@ class Serializer(BaseSerializer):
|
||||||
|
|
||||||
def get_initial(self):
|
def get_initial(self):
|
||||||
if self._initial_data is not None:
|
if self._initial_data is not None:
|
||||||
return ReturnDict([
|
return self.to_representation(self._initial_data)
|
||||||
(field_name, field.get_value(self._initial_data))
|
|
||||||
for field_name, field in self.fields.items()
|
|
||||||
if field.get_value(self._initial_data) is not empty
|
|
||||||
], serializer=self)
|
|
||||||
|
|
||||||
return ReturnDict([
|
return ReturnDict([
|
||||||
(field.field_name, field.get_initial())
|
(field.field_name, field.get_initial())
|
||||||
|
|
Loading…
Reference in New Issue
Block a user