perf: 添加 edition 字段

pull/10659/head
ibuler 2023-06-09 15:40:41 +08:00
parent 8f8e781376
commit 6a73cd6b77
7 changed files with 497 additions and 372 deletions

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a93b6a850b251ea2ee17b6b9dbdee93130f745ce8278faaecbf60d74f934f1b5
size 143780
oid sha256:7db1805061d28a0ba931846140e9f106b71ed5ebeb414f741b68d6c3d93130be
size 142961

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f236155485cdb4b453ff317d3c932ef4455d29e856ef3c2902a349d430992404
size 117637
oid sha256:4a22b436e9707729e51614e9942bb9715084ddf613152fa35be7a092a77daca7
size 117063

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,18 @@
# Generated by Django 3.2.17 on 2023-06-09 02:50
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('terminal', '0061_applet_can_concurrent'),
]
operations = [
migrations.AddField(
model_name='applet',
name='edition',
field=models.CharField(default='community', max_length=128, verbose_name='Edition'),
),
]

View File

@ -25,10 +25,16 @@ class Applet(JMSBaseModel):
general = 'general', _('General')
web = 'web', _('Web')
class Edition(models.TextChoices):
community = 'community', _('Community')
enterprise = 'enterprise', _('Enterprise')
name = models.SlugField(max_length=128, verbose_name=_('Name'), unique=True)
display_name = models.CharField(max_length=128, verbose_name=_('Display name'))
version = models.CharField(max_length=16, verbose_name=_('Version'))
author = models.CharField(max_length=128, verbose_name=_('Author'))
edition = models.CharField(max_length=128, choices=Edition.choices, default=Edition.community,
verbose_name=_('Edition'))
type = models.CharField(max_length=16, verbose_name=_('Type'), default='general', choices=Type.choices)
is_active = models.BooleanField(default=True, verbose_name=_('Is active'))
builtin = models.BooleanField(default=False, verbose_name=_('Builtin'))

View File

@ -27,6 +27,7 @@ class AppletPublicationSerializer(serializers.ModelSerializer):
class AppletSerializer(serializers.ModelSerializer):
icon = serializers.ReadOnlyField(label=_("Icon"))
type = LabeledChoiceField(choices=Applet.Type.choices, label=_("Type"))
edition = LabeledChoiceField(choices=Applet.Edition.choices, label=_("Edition"))
class Meta:
model = Applet
@ -35,6 +36,6 @@ class AppletSerializer(serializers.ModelSerializer):
'icon', 'readme', 'date_created', 'date_updated',
]
fields = fields_mini + [
'version', 'author', 'type', 'protocols',
'tags', 'comment'
'version', 'author', 'type', 'edition',
'can_concurrent', 'protocols', 'tags', 'comment',
] + read_only_fields