Fix serializer initial data

This commit is contained in:
Tom Christie 2014-11-07 14:13:50 +00:00
parent bb21216a7c
commit 55c44fc921

View File

@ -230,7 +230,11 @@ 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 self.to_representation(self._initial_data) return ReturnDict([
(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())