perf: 修改 session type 序列🥱

pull/9223/head
ibuler 2022-12-20 17:52:08 +08:00
parent 88355f55bb
commit 0748c32c5a
3 changed files with 3 additions and 2 deletions

View File

@ -35,7 +35,7 @@ def parse_sentinels_host(sentinels_host):
VERSION = const.VERSION
BASE_DIR = const.BASE_DIR
PROJECT_DIR = const.PROJECT_DIR
APP_DIR = os.path.join(PROJECT_DIR, 'apps')
APPS_DIR = os.path.join(PROJECT_DIR, 'apps')
DATA_DIR = os.path.join(PROJECT_DIR, 'data')
ANSIBLE_DIR = os.path.join(DATA_DIR, 'ansible')
CERTS_DIR = os.path.join(DATA_DIR, 'certs')

View File

@ -78,6 +78,7 @@ class DownloadUploadMixin:
with open(zip_path, 'rb') as f:
response = HttpResponse(f.read(), status=200, content_type='application/octet-stream')
response['Content-Disposition'] = 'attachment; filename*=UTF-8\'\'{}.zip'.format(instance.name)
os.unlink(zip_path)
return response

View File

@ -22,7 +22,7 @@ class SessionType(models.TextChoices):
class SessionSerializer(BulkOrgResourceModelSerializer):
org_id = serializers.CharField(allow_blank=True)
protocol = serializers.ChoiceField(choices=Protocol.choices, label=_("Protocol"))
type = LabeledChoiceField(choices=SessionType.choices, label=_("Type"))
type = LabeledChoiceField(choices=SessionType.choices, label=_("Type"), default=SessionType.normal)
class Meta:
model = Session