Closed tbeadle closed 1 month ago
I meet the same issue with ManyRelatedField
recently.
We cannot use sync version for ManyRelatedField
simply like this pr, because the internal methods call some db actions with sync version, which is not allowed.
A temporary solution is that defines a custom serializer for your many to many fields with a (custom) list serializer, and override acreate
and aupdate
in the outset serializer to handle these operations on those fields.
I'm OK to merge this PR to avoid the hardcoding of the fields but there are no tests for all the fields in DRF at the moment so I expect some minor issues which I will look into when I have time. I already merged @Vonfry PR 48 to fix the issue with the many to many field. Thanks again to both!
Don't hard-code the list of DRF_FIELDS--this was missing things like SerializerMethodField, ManyRelatedField, and ReadOnlyField.