-
Notifications
You must be signed in to change notification settings - Fork 117
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
Remove UniqueValidator from nested serializers on create method #46
Comments
The similar issue is #1 |
@Nekmo Hello! |
Thanks for your quick response! If this report is duplicated then it can be closed. Would not it be possible to automatically remove the validation if the instance already exists and the unique fields are not edited? Thank you. |
@Nekmo |
@ruscoder Thank you! |
@Nekmo Don't forget to wrap save() in the first serializer into I'm not sure about implementing this wrapping inside the library. I'll create an issue about atomic transactions to collect feedback. |
Hello, first of all thank you for creating this library. I think it should be included in the core!
I'm having a problem with the nested user serializer. Validation prevents set an existing user on POST method:
My code:
I have investigated the matter a bit and have found a solution:
https://medium.com/django-rest-framework/dealing-with-unique-constraints-in-nested-serializers-dade33b831d9
However, drop validation is a very dirty solution. The validation should be removed only if the user already exists.
Thank you.
The text was updated successfully, but these errors were encountered: