Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

Django warnings about use of ForeignKey(unique=True) #205

Open
ssciolla opened this issue Jan 16, 2020 · 0 comments
Open

Django warnings about use of ForeignKey(unique=True) #205

ssciolla opened this issue Jan 16, 2020 · 0 comments

Comments

@ssciolla
Copy link
Contributor

ssciolla commented Jan 16, 2020

When starting up the project via docker-compose, there are a number of messages from Django suggesting that we should consider replacing the use of ForeignKey(unique=True) for model fields with OneToOneField. The messages specifically look like this:

seumich.ClassSiteScore.class_site: (fields.W342) Setting unique=True on a ForeignKey has the same effect as using a OneToOneField.
HINT: ForeignKey(unique=True) is usually better served by a OneToOneField.

If we have the bandwidth at some point, it would be nice to make these changes, so we're following best practice and (more importantly, for our daily lives) we don't see these messages any more.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant