1👍
You need to override create
method if you want to create the B
objects as well.
From the documentation of Writable Nested Serializers:
By default nested serializers are
read-only
. If you want to support write-operations to a nested serializer field you’ll need to createcreate()
and/orupdate()
methods in order to explicitly specify how the child relationships should be saved.
👤AKS
0👍
You probably don’t need the many=True
kwarg if you already use ListField.
But you should be looking at the solution provided by AKS.
- Django modelform widget readonly render text not input field
- Django populate() isn't reentrant on multilanguage setup with different domains
- Python+django trying to serialize mongoengine documents to json but getting only arrays of fields names
Source:stackexchange.com