Fix custom inventory scripts on org deletion

We'll now clear the organization for it, this requires a database
migration to accept null values for custom inventory scripts
This commit is contained in:
Matthew Jones
2015-10-19 12:05:02 -04:00
parent 4692c13a9d
commit b25413002c
3 changed files with 528 additions and 1 deletions

View File

@@ -53,6 +53,12 @@ class Organization(CommonModel):
def __unicode__(self):
return self.name
def mark_inactive(self, save=True):
for script in self.custom_inventory_scripts.all():
script.organization = None
script.save()
super(Organization, self).mark_inactive(save=save)
class Team(CommonModelNameNotUnique):
'''