Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation problem: parent isn't set for nested serializer's fields on the validation stage #1

Closed
ruscoder opened this issue Mar 12, 2017 · 8 comments

Comments

@ruscoder
Copy link
Member

ruscoder commented Mar 12, 2017

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.

@cjroth
Copy link

cjroth commented Nov 13, 2017

Same as #28

@cjroth
Copy link

cjroth commented Nov 16, 2017

I believe this fixes it: #29

@ruscoder
Copy link
Member Author

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

@ruscoder
Copy link
Member Author

ruscoder commented Dec 4, 2017

@ruscoder
Copy link
Member Author

ruscoder commented Aug 17, 2018

Now we are working on a workaround for this issue

@ruscoder
Copy link
Member Author

@dz0
Copy link

dz0 commented Sep 7, 2018

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.

@pmontu
Copy link

pmontu commented Dec 8, 2022

Would UniqueFieldsMixin move validations of unique_together as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants