summaryrefslogtreecommitdiff
path: root/django/db/models/base.py
diff options
context:
space:
mode:
Diffstat (limited to 'django/db/models/base.py')
-rw-r--r--django/db/models/base.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/django/db/models/base.py b/django/db/models/base.py
index b679d08654..2a8e5fd2c8 100644
--- a/django/db/models/base.py
+++ b/django/db/models/base.py
@@ -18,7 +18,7 @@ from django.db import (
)
from django.db.models import signals
from django.db.models.constants import LOOKUP_SEP
-from django.db.models.deletion import Collector
+from django.db.models.deletion import CASCADE, Collector
from django.db.models.fields import AutoField
from django.db.models.fields.related import (
ForeignObjectRel, ManyToOneRel, OneToOneField, lazy_related_operation,
@@ -230,8 +230,13 @@ class ModelBase(type):
field = parent_links[base_key]
elif not is_proxy:
attr_name = '%s_ptr' % base._meta.model_name
- field = OneToOneField(base, name=attr_name,
- auto_created=True, parent_link=True)
+ field = OneToOneField(
+ base,
+ on_delete=CASCADE,
+ name=attr_name,
+ auto_created=True,
+ parent_link=True,
+ )
# Only add the ptr field if it's not already present;
# e.g. migrations will already have it specified
if not hasattr(new_class, attr_name):