mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-11 04:07:39 +03:00
Merge branch 'master' into dont-deserialize-twice
This commit is contained in:
commit
4e2627736f
|
@ -1,4 +1,4 @@
|
||||||
recursive-include rest_framework/static *.js *.css *.png
|
recursive-include rest_framework/static *.js *.css *.png *.eot *.svg *.ttf *.woff
|
||||||
recursive-include rest_framework/templates *.html
|
recursive-include rest_framework/templates *.html
|
||||||
recursive-exclude * __pycache__
|
recursive-exclude * __pycache__
|
||||||
recursive-exclude * *.py[co]
|
recursive-exclude * *.py[co]
|
||||||
|
|
|
@ -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())
|
||||||
|
|
Loading…
Reference in New Issue
Block a user