add ai models

This commit is contained in:
xie7654
2025-07-11 15:55:49 +08:00
parent ec30340b43
commit 62bba7d23f
9 changed files with 1541 additions and 407 deletions

View File

@@ -9,7 +9,20 @@ class CommonStatus(models.IntegerChoices):
DISABLED = 0, '禁用'
ENABLED = 1, '启用'
class CoreModel(models.Model):
class AutoCommentModel(models.Model):
class Meta:
abstract = True
# 给字段自动添加db_comment
def __init_subclass__(cls, **kwargs):
super().__init_subclass__(**kwargs)
for field in cls._meta.fields:
if getattr(field, 'verbose_name', None) and not getattr(field, 'db_comment', None):
field.db_comment = field.verbose_name
class CoreModel(AutoCommentModel):
remark = models.CharField(max_length=256, db_comment="备注", null=True, blank=True, help_text="备注",
verbose_name="备注")
creator = models.CharField(max_length=64, null=True, blank=True, help_text="创建人", db_comment="创建人",