1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #29998 -- Allowed multiple OneToOneFields to the parent model.

We assumed that any OneToOneField's in a child model must be the
parent link and raised an error when parent_link=True was not
specified. This patch allows to specify multiple OneToOneField's to
the parent model.

OneToOneField's without a custom related_name will raise fields.E304
and fields.E305 so this should warn users when they try to override
the auto-created OneToOneField.
This commit is contained in:
Mariusz Felisiak
2020-01-16 08:06:16 +01:00
committed by GitHub
parent 7400da49a5
commit bf77669453
5 changed files with 47 additions and 14 deletions

View File

@@ -345,6 +345,7 @@ class StateTests(SimpleTestCase):
'migrations.Tag',
models.CASCADE,
auto_created=True,
parent_link=True,
primary_key=True,
to_field='id',
serialize=False,