Skip to content

Commit

Permalink
minor: update UserField models (#1235)
Browse files Browse the repository at this point in the history
  • Loading branch information
narasux authored Sep 14, 2023
1 parent 26cf99c commit b23d557
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Generated by Django 3.2.20 on 2023-09-14 02:13

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('tenant', '0002_tenantusercustomfield_userbuiltinfield'),
]

operations = [
migrations.AlterField(
model_name='tenantusercustomfield',
name='data_type',
field=models.CharField(choices=[('string', '字符串'), ('number', '数字'), ('enum', '枚举'), ('multi_enum', '多选枚举')], max_length=32, verbose_name='数据类型'),
),
migrations.AlterField(
model_name='userbuiltinfield',
name='data_type',
field=models.CharField(choices=[('string', '字符串'), ('number', '数字'), ('enum', '枚举'), ('multi_enum', '多选枚举')], max_length=32, verbose_name='数据类型'),
),
migrations.AlterField(
model_name='userbuiltinfield',
name='display_name',
field=models.CharField(max_length=128, unique=True, verbose_name='展示用名称'),
),
migrations.AlterUniqueTogether(
name='tenantusercustomfield',
unique_together={('display_name', 'tenant'), ('name', 'tenant')},
),
migrations.RemoveField(
model_name='tenantusercustomfield',
name='order',
),
]
7 changes: 3 additions & 4 deletions src/bk-user/bkuser/apps/tenant/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class UserBuiltinField(TimestampedModel):
"""用户内置字段"""

name = models.CharField("字段名称", unique=True, max_length=128)
display_name = models.CharField("展示用名称", max_length=128)
display_name = models.CharField("展示用名称", unique=True, max_length=128)
data_type = models.CharField("数据类型", choices=UserFieldDataType.get_choices(), max_length=32)
required = models.BooleanField("是否必填")
unique = models.BooleanField("是否唯一")
Expand All @@ -128,14 +128,13 @@ class TenantUserCustomField(TimestampedModel):
display_name = models.CharField("展示用名称", max_length=128)
data_type = models.CharField("数据类型", choices=UserFieldDataType.get_choices(), max_length=32)
required = models.BooleanField("是否必填")
order = models.IntegerField("展示顺序", default=0)
default = models.JSONField("默认值", default="")
options = models.JSONField("配置项", default={})

class Meta:
unique_together = [
("tenant", "name"),
("tenant", "display_name"),
("name", "tenant"),
("display_name", "tenant"),
]


Expand Down

0 comments on commit b23d557

Please sign in to comment.