beda-software/drf-writable-nested

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.

Same as #28

I believe this fixes it: #29

@cjroth #29 is connected to one-to-one relations only. This issue relates to the more common problem and only on the validation stage.

Now we are working on a workaround for this issue

dz0 commented

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?