#25535 closed Bug (fixed)
ForeignObject checks are too strict
Reported by: | Antoine Catton | Owned by: | nobody |
---|---|---|---|
Component: | Core (System checks) | Version: | dev |
Severity: | Normal | Keywords: | ForeignObject check framework |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Let's consider this test case:
class Parent(models.Model): a = models.Field() b = models.Field() class Meta: unique_together = ( ('a', 'b'), ) class Child(models.Model): a = models.Field() b = models.Field() parent = ForeignObject(Parent, from_fields=('a', 'b'), to_fields=('a', 'b'))
I get the error: None of the fields 'a', 'b' on 'Parent' have a unique=True constraint.
But a and b are unique together, the ForeignObject will be functional.
Change History (7)
comment:1 by , 9 years ago
comment:2 by , 9 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:3 by , 9 years ago
Triage Stage: | Accepted → Ready for checkin |
---|---|
Type: | New feature → Bug |
I think this is more of a bug than a new feature. The provided patch looks good to me as I'm not convinced this is worth a mention in the release notes.
comment:4 by , 9 years ago
ForeignObject and multicolumn foreign keys using it are private API. So, as long as we don't have changes to public API not release notes is OK for me.
Note:
See TracTickets
for help on using tickets.
Here's my patch: https://github.com/django/django/pull/5419