diff --git a/api/features/migrations/0036_alter_feature_options.py b/api/features/migrations/0036_alter_feature_options.py new file mode 100644 index 000000000000..bc043c1b0b8b --- /dev/null +++ b/api/features/migrations/0036_alter_feature_options.py @@ -0,0 +1,17 @@ +# Generated by Django 3.2.12 on 2022-03-23 11:42 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('features', '0035_auto_20211109_0603'), + ] + + operations = [ + migrations.AlterModelOptions( + name='feature', + options={'ordering': ('id',)}, + ), + ] diff --git a/api/organisations/invites/migrations/0003_auto_20220323_1455.py b/api/organisations/invites/migrations/0003_auto_20220323_1455.py new file mode 100644 index 000000000000..7d1ed8d4df42 --- /dev/null +++ b/api/organisations/invites/migrations/0003_auto_20220323_1455.py @@ -0,0 +1,23 @@ +# Generated by Django 3.2.12 on 2022-03-23 14:55 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('invites', '0002_auto_20210118_2026'), + ] + + operations = [ + migrations.AlterField( + model_name='invite', + name='role', + field=models.CharField(choices=[('ADMIN', 'Admin'), ('USER', 'User')], default='USER', max_length=50), + ), + migrations.AlterField( + model_name='invitelink', + name='role', + field=models.CharField(choices=[('ADMIN', 'Admin'), ('USER', 'User')], default='USER', max_length=50), + ), + ] diff --git a/api/organisations/invites/models.py b/api/organisations/invites/models.py index 35de8c3e4339..76e7159ed65d 100644 --- a/api/organisations/invites/models.py +++ b/api/organisations/invites/models.py @@ -5,11 +5,7 @@ from django.utils import timezone from app.utils import create_hash -from organisations.models import ( - Organisation, - OrganisationRole, - organisation_roles, -) +from organisations.models import Organisation, OrganisationRole from users.models import FFAdminUser @@ -18,7 +14,9 @@ class AbstractBaseInviteModel(models.Model): date_created = models.DateTimeField("DateCreated", auto_now_add=True) organisation = models.ForeignKey(Organisation, on_delete=models.CASCADE) role = models.CharField( - choices=organisation_roles, max_length=50, default=OrganisationRole.USER.name + choices=OrganisationRole.choices, + max_length=50, + default=OrganisationRole.USER, ) class Meta: diff --git a/api/organisations/migrations/0030_alter_userorganisation_role.py b/api/organisations/migrations/0030_alter_userorganisation_role.py new file mode 100644 index 000000000000..e015a71fe01a --- /dev/null +++ b/api/organisations/migrations/0030_alter_userorganisation_role.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.12 on 2022-03-23 14:55 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('organisations', '0029_add_max_api_calls_to_subscription_model'), + ] + + operations = [ + migrations.AlterField( + model_name='userorganisation', + name='role', + field=models.CharField(choices=[('ADMIN', 'Admin'), ('USER', 'User')], max_length=50), + ), + ] diff --git a/api/organisations/models.py b/api/organisations/models.py index adcdba6ea45f..c1805bb22b27 100644 --- a/api/organisations/models.py +++ b/api/organisations/models.py @@ -17,12 +17,9 @@ from webhooks.models import AbstractBaseWebhookModel -class OrganisationRole(enum.Enum): - ADMIN = "ADMIN" - USER = "USER" - - -organisation_roles = ((tag.name, tag.value) for tag in OrganisationRole) +class OrganisationRole(models.TextChoices): + ADMIN = ("ADMIN", "Admin") + USER = ("USER", "User") class Organisation(models.Model): @@ -89,7 +86,7 @@ class UserOrganisation(models.Model): user = models.ForeignKey("users.FFAdminUser", on_delete=models.CASCADE) organisation = models.ForeignKey(Organisation, on_delete=models.CASCADE) date_joined = models.DateTimeField(auto_now_add=True) - role = models.CharField(max_length=50, choices=organisation_roles) + role = models.CharField(max_length=50, choices=OrganisationRole.choices) class Meta: unique_together = (