Open sebitoelcheater opened 6 years ago
Can you try going with the implicit EmbeddedDocumentSerializer
for discount, without creating one of your own? Also, make sure that the versions of libraries are exactly as follows:
django==1.9
djangorestframework==3.3.3
mongoengine==0.9
pymongo==2.7
What do you think about this fix? https://github.com/sebitoelcheater/django-rest-framework-mongoengine/commit/16f7bef79af1d9b9db8690e9327e2783fb3629eb
I'm also facing the same issue related to the EmbeddedDocumentSerializer and here the value for EmbeddedDocumentSerializer field is an object of model. It returns the error like above:
AttributeError: 'Modelname' object has no attribute 'items'
Any suggestions please.
Package versions: django == 3.0.4 djangorestframework == 3.11.0 mongoengine == 0.19.1 pymongo == 3.10.1 django-rest-framework-mongoengine == 3.4.1
I have a Charger document that contains a discount EmbeddedDocumentField. I also have a serializer for Charger.
When I call save on ChargerSerializer with discount set to None, it raises this error
in
recursive_save
method ofDocumentSerializer
, it's assumed that validated_data won't be null but it might.