Skip to content

Commit 5e67873

Browse files
committed
Remove team relationshisp and add new AAP organization
1 parent 79715e4 commit 5e67873

File tree

4 files changed

+42
-37
lines changed

4 files changed

+42
-37
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Generated manually to create new Organization model
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
("organizations", "0004_organization_enable_anonymization"),
10+
]
11+
12+
operations = [
13+
migrations.CreateModel(
14+
name="Organization",
15+
fields=[
16+
(
17+
"id",
18+
models.BigAutoField(
19+
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
20+
),
21+
),
22+
("name", models.CharField(help_text="The name of this organization.", max_length=512)),
23+
(
24+
"description",
25+
models.TextField(blank=True, default="", help_text="The organization description."),
26+
),
27+
],
28+
options={
29+
"ordering": ["id"],
30+
},
31+
),
32+
]

ansible_ai_connect/organizations/models.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,13 @@ def __make_organization_request_to_launchdarkly(self, flag: str) -> bool:
7878
flag,
7979
{"kind": "organization", "key": str(self.id)},
8080
)
81+
82+
83+
class Organization(models.Model):
84+
id = models.BigAutoField(primary_key=True)
85+
name = models.CharField(max_length=512, help_text="The name of this organization.")
86+
description = models.TextField(blank=True, default="", help_text="The organization description.")
87+
88+
class Meta:
89+
app_label = "organizations"
90+
ordering = ["id"]

ansible_ai_connect/users/migrations/0017_alter_user_options_team.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,6 @@ class Migration(migrations.Migration):
4545
"description",
4646
models.TextField(blank=True, default="", help_text="The team description."),
4747
),
48-
(
49-
"admins",
50-
models.ManyToManyField(
51-
blank=True,
52-
help_text="The list of admins for this team",
53-
related_name="teams_administered",
54-
to=settings.AUTH_USER_MODEL,
55-
),
56-
),
5748
(
5849
"created_by",
5950
models.ForeignKey(
@@ -87,21 +78,6 @@ class Migration(migrations.Migration):
8778
to="organizations.organization",
8879
),
8980
),
90-
(
91-
"team_parents",
92-
models.ManyToManyField(
93-
blank=True, related_name="team_children", to="users.team"
94-
),
95-
),
96-
(
97-
"users",
98-
models.ManyToManyField(
99-
blank=True,
100-
help_text="The list of users on this team",
101-
related_name="teams",
102-
to=settings.AUTH_USER_MODEL,
103-
),
104-
),
10581
],
10682
options={
10783
"ordering": ["id"],

ansible_ai_connect/users/models.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,6 @@ class Team(AbstractTeam):
182182
"""A Team compatible with Django Ansible Base Teams"""
183183

184184
resource = AnsibleResourceField(primary_key_field="id")
185-
team_parents = models.ManyToManyField("Team", related_name="team_children", blank=True)
186185

187186
ignore_relations = []
188187

@@ -191,16 +190,4 @@ class Meta:
191190
ordering = ["id"]
192191
abstract = False
193192

194-
users = models.ManyToManyField(
195-
User,
196-
related_name="teams",
197-
blank=True,
198-
help_text="The list of users on this team",
199-
)
200193

201-
admins = models.ManyToManyField(
202-
User,
203-
related_name="teams_administered",
204-
blank=True,
205-
help_text="The list of admins for this team",
206-
)

0 commit comments

Comments
 (0)