ForeignKey _id
UniqueConstraint discrepancy
#9619
Unanswered
kbehlers
asked this question in
Potential Issue
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Related to #9410 and #7173, so not sure if it belongs as a comment on one of those or should be a separate bug ticket.
The implementation for ModelSerializer generating UniqueConstraints gets circumvented if the UniqueConstraint involves a ForeignKey and the UniqueConstraint.fields uses the syntax without the
_id
suffix but the ModelSerializer.Meta.fields uses the syntax with_id
suffix.It appears to be related to https://github.com/encode/django-rest-framework/pull/7438/files#diff-c33f1f011c9f5cf3ed1357b809ebf2b4ed0b808b227c6c007291bf9b259422ecR1449, which compares
field_names
andunique_together_list
without considering that the UniqueConstraint is allowed to include a ForeignKey that doesn't have the_id
suffix.Minimum Reproducible Example:
Beta Was this translation helpful? Give feedback.
All reactions