From e4e9a121a41875b1d7f5ceb79db7d4110719fd2e Mon Sep 17 00:00:00 2001 From: Sabrina Demagny Date: Thu, 27 Mar 2025 11:06:15 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8(organization)=20add=20`is=5Factive`?= =?UTF-8?q?=20field?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add flag to indicate whether the organization is active. Prepare organizations provisioning. The organization will be created with this flag set to False and will become active when the first user is associated with it. --- CHANGELOG.md | 1 + src/backend/core/admin.py | 2 ++ .../migrations/0013_organization_is_active.py | 18 ++++++++++++++++++ src/backend/core/models.py | 1 + 4 files changed, 22 insertions(+) create mode 100644 src/backend/core/migrations/0013_organization_is_active.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 84c702c..353aa29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to ### Added +- ✨(organization) add `is_active` field - ✨(domains) notify support when domain status changes #668 - ✨(domains) define domain check interval as a settings - ✨(oidc) add simple introspection backend #832 diff --git a/src/backend/core/admin.py b/src/backend/core/admin.py index 5afc2e3..b565984 100644 --- a/src/backend/core/admin.py +++ b/src/backend/core/admin.py @@ -241,9 +241,11 @@ class OrganizationAdmin(admin.ModelAdmin): actions = [run_post_creation_plugins] list_display = ( "name", + "is_active", "created_at", "updated_at", ) + list_filter = ("is_active",) search_fields = ("name",) inlines = (OrganizationAccessInline, OrganizationServiceProviderInline) exclude = ("service_providers",) # Handled by the inline diff --git a/src/backend/core/migrations/0013_organization_is_active.py b/src/backend/core/migrations/0013_organization_is_active.py new file mode 100644 index 0000000..10d5152 --- /dev/null +++ b/src/backend/core/migrations/0013_organization_is_active.py @@ -0,0 +1,18 @@ +# Generated by Django 5.1.7 on 2025-03-27 10:03 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0012_organization_metadata'), + ] + + operations = [ + migrations.AddField( + model_name='organization', + name='is_active', + field=models.BooleanField(default=True, verbose_name='active'), + ), + ] diff --git a/src/backend/core/models.py b/src/backend/core/models.py index b093da4..f8dcebe 100644 --- a/src/backend/core/models.py +++ b/src/backend/core/models.py @@ -393,6 +393,7 @@ class Organization(BaseModel): related_name="organizations", blank=True, ) + is_active = models.BooleanField(verbose_name=_("active"), default=True) objects = OrganizationManager()