#26044: Misleading Warning "HINT: ForeignKey(unique=True) is usually better
served
by a OneToOneField."
--------------------------------------------+--------------------
Reporter: srkunze | Owner: nobody
Type: Uncategorized | Status: new
Component: Core (Management commands) | Version: 1.8
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------------+--------------------
When upgrading from Django 1.7 to Django 1.8 using the runserver command,
we noticed we get plenty of the following warnings:
mode.field_name: (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.
We found that ForeignKey with unique scales usually better for two
reasons:
1) no need to handle None
2) changing from unique to non-unique is straight forward as one already
works with collections
Is there a way to suppress/remove that warning ?
--
Ticket URL: <https://code.djangoproject.com/ticket/26044>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/050.7869c47795a0f5f90e658d9a983f0629%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.