Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7k
TestUniqueConstraintValidation failing on foreign key field#9678
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:master
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
tests/test_validators.py Outdated
class UniqueConstraintModel(models.Model): | ||
race_name = models.CharField(max_length=100) | ||
position = models.IntegerField() | ||
global_id = models.IntegerField() | ||
fancy_conditions = models.IntegerField() |
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.
Would you mind keeping this model as it was and add a new model to cover the newForeignKey
use case. Would avoid a potential fix breaking a behaviour with non-foreign key fields. Thanks
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.
Sure, I reverted the changes I made to the test and created another one covering the ForeignKey use case.
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.
Thank you 🙌🏻
Description
This merge request contains the changes to the TestUniqueConstraintValidation test case to reproduce the problem where the constraints are not being applied if the field is a foreign key as request by@browniebrokecomment.