streams: Add ChannelFolder table.

Fixes part of #31972.
This commit is contained in:
Sahil Batra
2025-05-02 17:17:56 +05:30
committed by Tim Abbott
parent e2b90176ee
commit 350f6a1fa1
6 changed files with 103 additions and 0 deletions

View File

@@ -3,6 +3,7 @@ from zerver.models.alert_words import AlertWord as AlertWord
from zerver.models.bots import BotConfigData as BotConfigData
from zerver.models.bots import BotStorageData as BotStorageData
from zerver.models.bots import Service as Service
from zerver.models.channel_folders import ChannelFolder as ChannelFolder
from zerver.models.clients import Client as Client
from zerver.models.custom_profile_fields import CustomProfileField as CustomProfileField
from zerver.models.custom_profile_fields import CustomProfileFieldValue as CustomProfileFieldValue

View File

@@ -0,0 +1,22 @@
from django.db import models
from django.utils.timezone import now as timezone_now
from zerver.models.realms import Realm
from zerver.models.users import UserProfile
class ChannelFolder(models.Model):
MAX_NAME_LENGTH = 100
MAX_DESCRIPTION_LENGTH = 1024
realm = models.ForeignKey(Realm, on_delete=models.CASCADE)
name = models.CharField(max_length=MAX_NAME_LENGTH)
description = models.CharField(max_length=MAX_DESCRIPTION_LENGTH, default="")
rendered_description = models.TextField(default="")
date_created = models.DateTimeField(default=timezone_now)
creator = models.ForeignKey(UserProfile, null=True, on_delete=models.SET_NULL)
is_archived = models.BooleanField(default=False)
class Meta:
unique_together = ("realm", "name")