mirror of
https://github.com/django/django.git
synced 2024-12-23 01:25:58 +00:00
Added cliff688's more concise explanation.
Co-authored-by: Clifford Gama <53076065+cliff688@users.noreply.github.com>
This commit is contained in:
parent
4cf8913fae
commit
0a02e4e3c4
@ -154,9 +154,11 @@ 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 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
|
||||
Finally, note that a :class:`~django.db.models.ForeignKey` defines a
|
||||
relationship between models. This creates a one-to-many relationship, where
|
||||
a ``Question`` can have multiple related ``Choice`` instances. Django supports
|
||||
all the common database relationships: many-to-one, many-to-many, and
|
||||
one-to-one.
|
||||
relationships: many-to-one, many-to-many, and one-to-one.
|
||||
|
||||
Activating models
|
||||
|
Loading…
Reference in New Issue
Block a user