From 2795f11e3ffe910780cce3cc4026da555a3e0c0d Mon Sep 17 00:00:00 2001 From: Aman Agrawal Date: Wed, 29 Nov 2023 09:38:09 +0000 Subject: [PATCH] models: Add org_type to RemoteZulipServer. This is required to save sponsorship data for remote servers. --- .../0041_remotezulipserver_org_type.py | 34 +++++++++++++++++++ zilencer/models.py | 6 ++++ 2 files changed, 40 insertions(+) create mode 100644 zilencer/migrations/0041_remotezulipserver_org_type.py diff --git a/zilencer/migrations/0041_remotezulipserver_org_type.py b/zilencer/migrations/0041_remotezulipserver_org_type.py new file mode 100644 index 0000000000..468f7a7efe --- /dev/null +++ b/zilencer/migrations/0041_remotezulipserver_org_type.py @@ -0,0 +1,34 @@ +# Generated by Django 4.2.7 on 2023-11-29 05:16 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("zilencer", "0040_remoterealm_authentication_methods_remoterealm_name"), + ] + + operations = [ + migrations.AddField( + model_name="remotezulipserver", + name="org_type", + field=models.PositiveSmallIntegerField( + choices=[ + (0, "Unspecified"), + (10, "Business"), + (20, "Open-source project"), + (30, "Education (non-profit)"), + (35, "Education (for-profit)"), + (40, "Research"), + (50, "Event or conference"), + (60, "Non-profit (registered)"), + (70, "Government"), + (80, "Political group"), + (90, "Community"), + (100, "Personal"), + (1000, "Other"), + ], + default=0, + ), + ), + ] diff --git a/zilencer/models.py b/zilencer/models.py index f4229f5312..d1a24a1613 100644 --- a/zilencer/models.py +++ b/zilencer/models.py @@ -58,6 +58,12 @@ class RemoteZulipServer(models.Model): # The current billing plan for the remote server, similar to Realm.plan_type. plan_type = models.PositiveSmallIntegerField(default=PLAN_TYPE_SELF_HOSTED) + # This is not synced with the remote server, but only filled for sponsorship requests. + org_type = models.PositiveSmallIntegerField( + default=Realm.ORG_TYPES["unspecified"]["id"], + choices=[(t["id"], t["name"]) for t in Realm.ORG_TYPES.values()], + ) + @override def __str__(self) -> str: return f"{self.hostname} {str(self.uuid)[0:12]}"