1
0
mirror of https://github.com/django/django.git synced 2025-03-31 11:37:06 +00:00

Clarified what a ForeignKey relationship entails in documentation.

This commit is contained in:
GappleBee 2024-08-24 11:51:20 +01:00
parent cdcd604ef8
commit 4cf8913fae

View File

@ -154,9 +154,9 @@ A :class:`~django.db.models.Field` can also have various optional arguments; in
this case, we've set the :attr:`~django.db.models.Field.default` value of
``votes`` to 0.
Finally, note a relationship is defined, using
:class:`~django.db.models.ForeignKey`. That tells Django each ``Choice`` is
related to a single ``Question``. Django supports all the common database
Finally, note that a relationship is defined, using
:class:`~django.db.models.ForeignKey`. That tells Django that each ``Choice`` is
related to a single ``Question``. However, this doesn't mean that each ``Question`` is related to only one ``Choice``. One ``Question`` could have many ``Choice`` instances related to it. As a result, this relationship would be defined as many-to-one. Django supports all the common database
relationships: many-to-one, many-to-many, and one-to-one.
Activating models