summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlanCoding <arominge@redhat.com>2016-07-14 20:38:43 +0200
committerAlanCoding <arominge@redhat.com>2016-07-14 20:38:43 +0200
commit68d5a702af292d2bf958422fed742b39b4757b0f (patch)
treee70e1707ea54d0d0f97f81c471d808621b65d6a3
parentCascade delete teams when their organization is deleted (diff)
downloadawx-68d5a702af292d2bf958422fed742b39b4757b0f.tar.xz
awx-68d5a702af292d2bf958422fed742b39b4757b0f.zip
Team organization field made non-null
-rw-r--r--awx/main/migrations/0028_v300_org_team_cascade.py3
-rw-r--r--awx/main/models/organization.py2
2 files changed, 3 insertions, 2 deletions
diff --git a/awx/main/migrations/0028_v300_org_team_cascade.py b/awx/main/migrations/0028_v300_org_team_cascade.py
index bf798df3c3..80378c5729 100644
--- a/awx/main/migrations/0028_v300_org_team_cascade.py
+++ b/awx/main/migrations/0028_v300_org_team_cascade.py
@@ -15,6 +15,7 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='team',
name='organization',
- field=models.ForeignKey(related_name='teams', to='main.Organization', null=True),
+ field=models.ForeignKey(related_name='teams', to='main.Organization'),
+ preserve_default=False,
),
]
diff --git a/awx/main/models/organization.py b/awx/main/models/organization.py
index 79cb3facdc..5f3dc9d7c9 100644
--- a/awx/main/models/organization.py
+++ b/awx/main/models/organization.py
@@ -92,7 +92,7 @@ class Team(CommonModelNameNotUnique, ResourceMixin):
organization = models.ForeignKey(
'Organization',
blank=False,
- null=True,
+ null=False,
on_delete=models.CASCADE,
related_name='teams',
)