feat: add client release size bytes

This commit is contained in:
QiuSW
2026-07-13 17:04:59 +08:00
parent 8878769ec5
commit b71564e2bf
13 changed files with 96 additions and 15 deletions
+2
View File
@@ -11,6 +11,7 @@ class DownloadReleaseAdmin(admin.ModelAdmin):
"is_current",
"force_update",
"download_source",
"size_bytes",
"sha256_short",
"updated_at",
)
@@ -36,6 +37,7 @@ class DownloadReleaseAdmin(admin.ModelAdmin):
"fields": (
"file",
"external_url",
"size_bytes",
"sha256",
)
},
@@ -0,0 +1,25 @@
# Generated by Django 5.2.15 on 2026-07-13
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("portal", "0003_importtemplate"),
]
operations = [
migrations.AddField(
model_name="downloadrelease",
name="size_bytes",
field=models.PositiveBigIntegerField(
blank=True,
help_text="客户端下载文件大小,单位字节;桌面端用于下载后校验。",
null=True,
validators=[django.core.validators.MinValueValidator(1)],
verbose_name="文件大小字节数",
),
),
]
+8 -1
View File
@@ -1,5 +1,5 @@
from django.core.exceptions import ValidationError
from django.core.validators import RegexValidator
from django.core.validators import MinValueValidator, RegexValidator
from django.db import models, transaction
@@ -13,6 +13,13 @@ class DownloadRelease(models.Model):
version = models.CharField("版本", max_length=64)
file = models.FileField("安装包文件", upload_to="downloads/", blank=True)
external_url = models.URLField("外部下载地址", blank=True)
size_bytes = models.PositiveBigIntegerField(
"文件大小字节数",
null=True,
blank=True,
validators=[MinValueValidator(1)],
help_text="客户端下载文件大小,单位字节;桌面端用于下载后校验。",
)
sha256 = models.CharField(
"SHA256",
max_length=64,