Files
fonrey/apps/client/models/folders.py
ishenwei e67b07a7c8 feat(client): add Chinese verbose_name and help_text to all client fields (Phase 4.1 part 2/9)
Sync DATA_MODEL_CLIENT.md field-level Chinese annotations to Django
models across 11 client tables (Client, ClientContact, ClientRequirement,
ClientSchoolPreference, ClientFavoriteFolder, ClientFolderItem,
ClientFollowLog, ClientFollowLogAttachment, ClientViewing,
ClientPropertyMatch, ClientStatusLog).

Pre-existing docstrings retained on ClientFollowLog (partitioned parent
treated as unmanaged) and ClientStatusLog (immutable audit log).
2026-04-30 09:19:58 +08:00

85 lines
2.4 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
from django.db import models
from core.models.base import UUIDPrimaryKeyModel
class ClientFavoriteFolder(UUIDPrimaryKeyModel):
staff = models.ForeignKey(
"org.Staff",
on_delete=models.CASCADE,
related_name="favorite_folders",
verbose_name="所属经纪人",
)
name = models.CharField(
max_length=10,
verbose_name="收藏夹名称",
help_text="最多10字",
)
is_default = models.BooleanField(
default=False,
verbose_name="是否默认",
help_text="系统默认收藏夹,每个经纪人只能有一个",
)
sort_order = models.IntegerField(
default=0,
verbose_name="显示顺序",
help_text="升序排列",
)
created_at = models.DateTimeField(
auto_now_add=True,
verbose_name="创建时间",
)
deleted_at = models.DateTimeField(
null=True,
blank=True,
verbose_name="删除时间",
help_text="软删除时间戳NULL=未删除",
)
class Meta:
db_table = "client_favorite_folders"
verbose_name = "私客收藏夹"
verbose_name_plural = "私客收藏夹"
indexes = [
models.Index(fields=["staff"], name="idx_cff_staff"),
]
constraints = [
models.UniqueConstraint(
fields=["staff"],
condition=models.Q(is_default=True, deleted_at__isnull=True),
name="uq_cff_default_per_staff",
),
]
class ClientFolderItem(models.Model):
folder = models.ForeignKey(
ClientFavoriteFolder,
on_delete=models.CASCADE,
related_name="items",
verbose_name="所属收藏夹",
)
client = models.ForeignKey(
"fonrey_client.Client",
on_delete=models.CASCADE,
related_name="folder_items",
verbose_name="被收藏的客源",
)
added_at = models.DateTimeField(
auto_now_add=True,
verbose_name="加入收藏夹时间",
)
class Meta:
db_table = "client_folder_items"
verbose_name = "收藏夹中的客源"
verbose_name_plural = "收藏夹中的客源"
constraints = [
models.UniqueConstraint(
fields=["folder", "client"], name="uq_cfi_folder_client"
),
]
indexes = [
models.Index(fields=["client"], name="idx_cfi_client"),
]