summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorRob <tienrobertnguyenn@gmail.com>2019-05-12 20:58:35 +1000
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2019-05-13 07:25:42 +0200
commitc231a75112d8a06e1a776ef97f28a3be1b343047 (patch)
treec62d201b2f85ed6cf368c6a7455307be7bec0759 /django
parent330638b89f14e1fb06e9d313ccc9768ae167c53f (diff)
Fixed #30436 -- Added check that on_delete is callable in ForeignKey and OneToOneField.
Diffstat (limited to 'django')
-rw-r--r--django/db/models/fields/related.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/django/db/models/fields/related.py b/django/db/models/fields/related.py
index 2eb802e570..276bcb11ff 100644
--- a/django/db/models/fields/related.py
+++ b/django/db/models/fields/related.py
@@ -797,6 +797,8 @@ class ForeignKey(ForeignObject):
# the to_field during FK construction. It won't be guaranteed to
# be correct until contribute_to_class is called. Refs #12190.
to_field = to_field or (to._meta.pk and to._meta.pk.name)
+ if not callable(on_delete):
+ raise TypeError('on_delete must be callable.')
kwargs['rel'] = self.rel_class(
self, to, to_field,