models: Add org_type to RemoteZulipServer.

This is required to save sponsorship data for remote servers.
This commit is contained in:
Aman Agrawal 2023-11-29 09:38:09 +00:00 committed by Tim Abbott
parent 405c28252a
commit 2795f11e3f
2 changed files with 40 additions and 0 deletions

View File

@ -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,
),
),
]

View File

@ -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]}"