You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I call save on ChargerSerializer with discount set to None, it raises this error
File "/Users/sebito/Developer/Proyectos/cargoo/cargoo/api/serializers/profile_serializer.py", line 89, in handle_update
instanced_serializer.save()
File "/Users/sebito/.virtualenvs/cargoo/lib/python3.6/site-packages/rest_framework/serializers.py", line 209, in save
self.instance = self.update(self.instance, validated_data)
File "/Users/sebito/.virtualenvs/cargoo/lib/python3.6/site-packages/rest_framework_mongoengine/serializers.py", line 269, in update
instance = self.recursive_save(validated_data, instance)
File "/Users/sebito/.virtualenvs/cargoo/lib/python3.6/site-packages/rest_framework_mongoengine/serializers.py", line 230, in recursive_save
me_data[key] = field.recursive_save(value)
File "/Users/sebito/.virtualenvs/cargoo/lib/python3.6/site-packages/rest_framework_mongoengine/serializers.py", line 224, in recursive_save
for key, value in validated_data.items():
AttributeError: 'NoneType' object has no attribute 'items'
in recursive_save method of DocumentSerializer, it's assumed that validated_data won't be null but it might.
The text was updated successfully, but these errors were encountered:
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:
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.
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.The text was updated successfully, but these errors were encountered: