Open MiltosD opened 1 year ago
I also tried to do curator = models.ForeignKey(...)
and remove many=True
from RecordSerializer, just to make sure that drf_writable_nested package works. It does and the object and relation in created as expected. It seems to me that ArrayReferenceField, which I suppose is just a list of ForeignKey, cannot be properly handled by rest framework...
Tried curator = models.ForeignKey(...)
and curator = PersonSerializer(many=True, required=False, allow_null=True)
in RecordSerializer and got the same error. I think that Rest Framework assumes that a ForeignKey field cannot be in an array, following relational db design.
One line description of the issue
I use Django 4.1.4 with djangorestframework 3.14.0 and drf_writable_nested 0.7.0 in order for rest framework to accept nested objects in POST
For a given model field I tried it as ManyToManyField and it works as expected. However, when I replace it with ArrayReferenceField, POST requests do not work.
Python Script