Warn when unique=True is set on ForeignKey
|Reported by:||funkybob||Owned by:||Tim Graham <timograham@…>|
|Component:||Core (System checks)||Version:||master|
|Cc:||Triage Stage:||Ready for checkin|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Long ago in the dark times before 1.0, there was a bug in Admin that meant using ForeignKey(unique=True) was preferable to using a OneToOneField.
Somehow, people (on IRC) are still doing this -- even new users-- , and I can't figure out why.
Unless I'm missing something, there is no case where a ForeignKey(unique=True) is preferable to a OneToOneField.
Shouldn't we, then, at least add a check/warn to say this?
Change History (13)
comment:2 Changed 8 months ago by JLinden
- Owner changed from nobody to JLinden
- Status changed from new to assigned
comment:6 Changed 7 months ago by diegoguimaraes
comment:9 Changed 6 months ago by timgraham
- Easy pickings unset
- Has patch set
- Patch needs improvement set
comment:10 Changed 6 months ago by JLinden
- Owner JLinden deleted
- Status changed from assigned to new
comment:11 Changed 6 months ago by timgraham
- Keywords afraid-to-commit removed
- Patch needs improvement unset
comment:12 Changed 5 months ago by timgraham
- Triage Stage changed from Accepted to Ready for checkin