Make sure that EE foreign keys are polymorphic.SET_NULL

Deleting EEs that had been attached to something was failing.
This commit is contained in:
Jeff Bradberry
2021-03-11 11:25:59 -05:00
parent e8b2072ea5
commit e31fc37215
4 changed files with 40 additions and 5 deletions

View File

@@ -27,6 +27,7 @@ from awx.main.models.rbac import (
)
from awx.main.models.unified_jobs import UnifiedJob
from awx.main.models.mixins import ResourceMixin, CustomVirtualEnvMixin, RelatedJobsMixin
from awx.main.utils import polymorphic
__all__ = ['Organization', 'Team', 'Profile', 'UserSessionMembership']
@@ -66,7 +67,7 @@ class Organization(CommonModel, NotificationFieldsModel, ResourceMixin, CustomVi
null=True,
blank=True,
default=None,
on_delete=models.SET_NULL,
on_delete=polymorphic.SET_NULL,
related_name='+',
help_text=_('The default execution environment for jobs run by this organization.'),
)