Warn when unique=True is set on ForeignKey
|Reported by:||Curtis Maloney||Owned by:|
|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?