#15121 closed (duplicate)
ForeignKey cascading deletes fail with Integrity Error when to_field attribute set to field other than primary key
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 1.3-beta |
Severity: | Keywords: | to_field, cascade, on_delete | |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
ForeignKey cascading delete fails with Integrity Error when to_field argument set to field other than primary key. Setting the on_delete argument doesn't change this behavior either.
For example:
models.ForeignKey(Design, related_name='reports', to_field="uuid", on_delete=models.CASCADE)
Change History (2)
comment:1 by , 14 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
Triage Stage: | Unreviewed → Accepted |
Note:
See TracTickets
for help on using tickets.
This is actually a symptom of #11319. If fixing #11319 turns out to be too difficult to do before 1.3, the deletion code could potentially work around it so deletions don't fail - but that's a last resort. Marking as duplicate.