Open gauravvjn opened 8 years ago
I believe, you need to explicitly define MyModel2Serializer and declare it as a field on MyModelSerializer:
class MyModel2Serializer(EmbeddedDocumentSerializer):
class Meta:
model = MyModel2
class MyModelSerializer(DynamicDocumentSerializer):
field4 = MyModel2Serializer()
class Meta:
model = MyModel
fields = ('field1', 'field4')
I've written a unit-test for your case and it is partially successful (though, fails for create()
, which I should sort out).
@gjain0 Could you try pulling the most recent commit and testing your case with it? I think it should be working by now. At least, similar unit-tests pass.
and here is the serializer
and view
but this api returns only field1, field2, field3. even after explicitly mentioning the field4.
PS: I'm using django-rest-framework-mongoengine==3.3.0 mongoengine==0.10.5