Open oxan opened 4 years ago
This is the same with direct relations. With direct relations however this gives an error at https://github.com/beda-software/drf-writable-nested/blob/master/drf_writable_nested/mixins.py#L207.
also come across this bug frequency + 1
Same bug here, Iit seems that validated data should be fetched and transmitted to update...() methods, instead of being popped and deleted at lines like https://github.com/beda-software/drf-writable-nested/blob/master/drf_writable_nested/mixins.py#L36 ; thus there would be no need for self.get_initial() ; but lists of dicts will have to be treated separately
frequency + 1
I've made pull-request to fix this issue. Please consider reviewing code. https://github.com/beda-software/drf-writable-nested/pull/141
If you want to try it, here is my fork: https://github.com/Feelixe-tin/drf-writable-nested
Serializers that are created with
many=True
have a list asinitial_data
. This results inget_initial()
returning an empty dictionary. DRF doesn't seem interested in changing this on their end, see encode/django-rest-framework#5345.The result of this is that the check in mixins.py:147 fails, and reverse relations (silently) aren't created or updated.
Not sure what's the best way to fix this (as behaviour on either side seems sensible), but it's clearly a bug.