Django Serialize Dict Object Has No Attribute Meta
I am working on an application that uses Django and MongoDB (as a model). I am trying to initialize (by hand) a model object (in order to send it further to another server), using the data got from a form. The model looks like this: class MyModel(DynamicDocument): studyname = StringField(default='first study') individualname = StringField(default='individual') filelist = ListField(StringField) # this is a list of paths to some files In the form I am doing the following: pilotobject = MyModel pilotobject.individualname = self.data'individualname' pilotobject.studyname = self.data'studyname' pilotobject.filelist = fileslist #file paths (strings) where self.data is the data received from the form. Now I want to serialize to JSON this object (pilotobject) as described in the documentation: dataserialized = serializers.serialize('json', pilotobject, ) but I get this error: 'MetaDict' object has no attribute 'concretemodel' and the serialization fails. Can anyone help?
Give More Feedback
- Because you don't have a Meta class defined. Django REST framework: AttributeError: Serializer object has. Object has no attribute 'Meta.
- Meta Discuss the workings and policies of this site. Django rest framework serialize a dictionary. 'tuple' object has no attribute 'project'.
'StationReportSerializer' object has no attribute 'Meta'. How to know if an object has an attribute in. Django-Rest-Framework - How to serialize queryset.