-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Fix nested serializers with unique_together relations.
#2975
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
Conversation
tests/test_model_serializer.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll likely want a slightly different representation for python 2.7.
See https://github.com/sheppard/django-rest-framework/blob/read-only-nested/tests/test_model_serializer.py#L172 for example.
|
The python 2.7 compatibility put appart, this looks good to me. |
|
Ok, I think I got it now, thanks for the tip. |
|
Confused - this is Milestoned as 2.4.6, but a pull request against master? |
|
@tomchristie my bad |
|
Perfect. I ensured the test failed without the correction. |
can't create nested serializers for unique_together relations
unique_together relations.
I came across an unexpected issue when trying to create a read-only nested serializer for a related field that's part of a
unique_togetherconstraint (in vera). Anextra_kwargsentry ofrequired=Trueis set for the constraint, but that conflicts withread_only=Trueset as the nested field'skwargs.