feat: 中文化 django-admin 分组与表名 (T-602 层1-3)
- 5 个 app 加 AppConfig.verbose_name(中文分组名) - 11 个模型加 Meta.verbose_name/verbose_name_plural(中文表名) - 3 条 AlterModelOptions 迁移(仅 options,无 DB schema 变更) - LANGUAGE_CODE=zh-hans / USE_I18N=True 已在,Django 自带 admin 与 auth 已中文 - 仅显示层,不改字段名/逻辑/表结构 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -4,3 +4,4 @@ from django.apps import AppConfig
|
||||
class AiConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'apps.ai'
|
||||
verbose_name = 'AI 模型配置'
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
# Generated by Django 5.2.15 on 2026-07-04 07:08
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('ai', '0002_aiconfigauditlog'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterModelOptions(
|
||||
name='aiconfigauditlog',
|
||||
options={'ordering': ('-created_at', '-id'), 'verbose_name': 'AI 配置审计日志', 'verbose_name_plural': 'AI 配置审计日志'},
|
||||
),
|
||||
migrations.AlterModelOptions(
|
||||
name='aimodel',
|
||||
options={'ordering': ('name',), 'verbose_name': 'AI 模型', 'verbose_name_plural': 'AI 模型'},
|
||||
),
|
||||
migrations.AlterModelOptions(
|
||||
name='modelalias',
|
||||
options={'ordering': ('operation_type', 'alias'), 'verbose_name': '能力别名', 'verbose_name_plural': '能力别名'},
|
||||
),
|
||||
]
|
||||
@@ -39,6 +39,8 @@ class AiModel(models.Model):
|
||||
|
||||
class Meta:
|
||||
db_table = "ai_model"
|
||||
verbose_name = "AI 模型"
|
||||
verbose_name_plural = "AI 模型"
|
||||
ordering = ("name",)
|
||||
|
||||
def __str__(self) -> str:
|
||||
@@ -103,6 +105,8 @@ class ModelAlias(models.Model):
|
||||
|
||||
class Meta:
|
||||
db_table = "model_alias"
|
||||
verbose_name = "能力别名"
|
||||
verbose_name_plural = "能力别名"
|
||||
ordering = ("operation_type", "alias")
|
||||
constraints = [
|
||||
models.UniqueConstraint(
|
||||
@@ -163,6 +167,8 @@ class AiConfigAuditLog(models.Model):
|
||||
|
||||
class Meta:
|
||||
db_table = "ai_config_audit_log"
|
||||
verbose_name = "AI 配置审计日志"
|
||||
verbose_name_plural = "AI 配置审计日志"
|
||||
ordering = ("-created_at", "-id")
|
||||
indexes = [
|
||||
models.Index(fields=("target_type", "target_id")),
|
||||
|
||||
@@ -4,3 +4,4 @@ from django.apps import AppConfig
|
||||
class ApiConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'apps.api'
|
||||
verbose_name = '对外 API'
|
||||
|
||||
@@ -4,3 +4,4 @@ from django.apps import AppConfig
|
||||
class BillingConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'apps.billing'
|
||||
verbose_name = '计费与充值'
|
||||
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
# Generated by Django 5.2.15 on 2026-07-04 07:08
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('billing', '0004_rechargeorder_and_more'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterModelOptions(
|
||||
name='callrecord',
|
||||
options={'ordering': ('-created_at', '-id'), 'verbose_name': '调用记录', 'verbose_name_plural': '调用记录'},
|
||||
),
|
||||
migrations.AlterModelOptions(
|
||||
name='exchangerate',
|
||||
options={'ordering': ('-effective_from', '-id'), 'verbose_name': '汇率', 'verbose_name_plural': '汇率'},
|
||||
),
|
||||
migrations.AlterModelOptions(
|
||||
name='pointsledger',
|
||||
options={'ordering': ('-created_at', '-id'), 'verbose_name': '点数流水', 'verbose_name_plural': '点数流水'},
|
||||
),
|
||||
migrations.AlterModelOptions(
|
||||
name='pricingrule',
|
||||
options={'ordering': ('operation_type', 'alias', 'resolution'), 'verbose_name': '计费规则', 'verbose_name_plural': '计费规则'},
|
||||
),
|
||||
migrations.AlterModelOptions(
|
||||
name='rechargeorder',
|
||||
options={'ordering': ('-created_at', '-id'), 'verbose_name': '充值订单', 'verbose_name_plural': '充值订单'},
|
||||
),
|
||||
]
|
||||
@@ -52,6 +52,8 @@ class CallRecord(models.Model):
|
||||
|
||||
class Meta:
|
||||
db_table = "call_record"
|
||||
verbose_name = "调用记录"
|
||||
verbose_name_plural = "调用记录"
|
||||
ordering = ("-created_at", "-id")
|
||||
constraints = [
|
||||
models.CheckConstraint(
|
||||
@@ -86,6 +88,8 @@ class PricingRule(models.Model):
|
||||
|
||||
class Meta:
|
||||
db_table = "pricing_rule"
|
||||
verbose_name = "计费规则"
|
||||
verbose_name_plural = "计费规则"
|
||||
ordering = ("operation_type", "alias", "resolution")
|
||||
constraints = [
|
||||
models.UniqueConstraint(
|
||||
@@ -129,6 +133,8 @@ class ExchangeRate(models.Model):
|
||||
|
||||
class Meta:
|
||||
db_table = "exchange_rate"
|
||||
verbose_name = "汇率"
|
||||
verbose_name_plural = "汇率"
|
||||
ordering = ("-effective_from", "-id")
|
||||
constraints = [
|
||||
models.CheckConstraint(
|
||||
@@ -190,6 +196,8 @@ class RechargeOrder(models.Model):
|
||||
|
||||
class Meta:
|
||||
db_table = "recharge_order"
|
||||
verbose_name = "充值订单"
|
||||
verbose_name_plural = "充值订单"
|
||||
ordering = ("-created_at", "-id")
|
||||
constraints = [
|
||||
models.CheckConstraint(
|
||||
@@ -256,6 +264,8 @@ class PointsLedger(models.Model):
|
||||
|
||||
class Meta:
|
||||
db_table = "points_ledger"
|
||||
verbose_name = "点数流水"
|
||||
verbose_name_plural = "点数流水"
|
||||
ordering = ("-created_at", "-id")
|
||||
constraints = [
|
||||
models.CheckConstraint(
|
||||
|
||||
@@ -4,3 +4,4 @@ from django.apps import AppConfig
|
||||
class PortalConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'apps.portal'
|
||||
verbose_name = '用户端'
|
||||
|
||||
@@ -4,3 +4,4 @@ from django.apps import AppConfig
|
||||
class UsersConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'apps.users'
|
||||
verbose_name = '用户与钱包'
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
# Generated by Django 5.2.15 on 2026-07-04 07:08
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('users', '0003_apikey_userwallet'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterModelOptions(
|
||||
name='apikey',
|
||||
options={'ordering': ('-created_at', '-id'), 'verbose_name': 'API 密钥', 'verbose_name_plural': 'API 密钥'},
|
||||
),
|
||||
migrations.AlterModelOptions(
|
||||
name='user',
|
||||
options={'verbose_name': '用户', 'verbose_name_plural': '用户'},
|
||||
),
|
||||
migrations.AlterModelOptions(
|
||||
name='userwallet',
|
||||
options={'ordering': ('user_id',), 'verbose_name': '用户钱包', 'verbose_name_plural': '用户钱包'},
|
||||
),
|
||||
]
|
||||
@@ -34,6 +34,8 @@ class User(AbstractUser):
|
||||
|
||||
class Meta:
|
||||
db_table = "user"
|
||||
verbose_name = "用户"
|
||||
verbose_name_plural = "用户"
|
||||
|
||||
|
||||
class UserWallet(models.Model):
|
||||
@@ -48,6 +50,8 @@ class UserWallet(models.Model):
|
||||
|
||||
class Meta:
|
||||
db_table = "user_wallet"
|
||||
verbose_name = "用户钱包"
|
||||
verbose_name_plural = "用户钱包"
|
||||
ordering = ("user_id",)
|
||||
constraints = [
|
||||
models.CheckConstraint(
|
||||
@@ -86,6 +90,8 @@ class ApiKey(models.Model):
|
||||
|
||||
class Meta:
|
||||
db_table = "api_key"
|
||||
verbose_name = "API 密钥"
|
||||
verbose_name_plural = "API 密钥"
|
||||
ordering = ("-created_at", "-id")
|
||||
indexes = [
|
||||
models.Index(fields=("user", "status")),
|
||||
|
||||
Reference in New Issue
Block a user