From b0c511a7a25a8219b09d4953b8bb40ca293a8edd Mon Sep 17 00:00:00 2001 From: Jeff Bradberry Date: Tue, 13 Jul 2021 11:36:20 -0400 Subject: [PATCH] Make non-polymorphic refs that slip through still work with our SET_NULL --- awx/main/utils/polymorphic.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/awx/main/utils/polymorphic.py b/awx/main/utils/polymorphic.py index 28f8a11187..a821ffeb10 100644 --- a/awx/main/utils/polymorphic.py +++ b/awx/main/utils/polymorphic.py @@ -15,4 +15,6 @@ def build_polymorphic_ctypes_map(cls): def SET_NULL(collector, field, sub_objs, using): - return models.SET_NULL(collector, field, sub_objs.non_polymorphic(), using) + if hasattr(sub_objs, 'non_polymorphic'): + sub_objs = sub_objs.non_polymorphic() + return models.SET_NULL(collector, field, sub_objs, using)