Validation problem: `parent` isn't set for nested serializer's fields on the validation stage
ruscoder opened this issue · 8 comments
I had found a problem on the validation stage when I used UniqueValidator
for nested serializer's field.
I've found the root of the problem - parent isn't set on the validation stage.
Now we are working on a workaround for this issue
There is an example how to get a workaround:
https://github.com/beda-software/drf-writable-nested#validation-problem-for-nested-serializers-with-unique-fields-on-update
but DRF also proposes way to deal with bulk updates by explicitly including id field (as not read_only)
http://www.django-rest-framework.org/api-guide/serializers/#customizing-multiple-update
this way, one get instance from id
ps.: in my case I had custom kind of uniqueness validation (checked if objects not overlap), so I excluded current instance by id in my validation query.
Would UniqueFieldsMixin move validations of unique_together as well?