houtai ok

This commit is contained in:
xiaoma
2026-02-02 22:56:58 +08:00
parent 62c7022d23
commit 34555a37ad
3 changed files with 22 additions and 2 deletions

View File

@@ -22,13 +22,15 @@ class ExternalUploadWidget(forms.URLInput):
'class': 'upload-url-input',
'data-upload-url': upload_url,
'data-accept': accept,
'style': 'width: 100%; margin-bottom: 5px;',
'readonly': 'readonly',
'placeholder': '上传文件后自动生成URL'
})
class Media:
js = ('shop/js/admin_upload.js',)
css = {
'all': ('shop/css/admin_upload.css',)
}
class ESP32ConfigAdminForm(forms.ModelForm):
class Meta:

View File

@@ -0,0 +1,18 @@
# Generated by Django 6.0.1 on 2026-02-02 14:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('shop', '0010_alter_esp32config_model_3d_url'),
]
operations = [
migrations.AlterField(
model_name='esp32config',
name='model_3d_url',
field=models.URLField(blank=True, null=True, verbose_name='产品3D模型 (URL)'),
),
]

View File

@@ -20,7 +20,7 @@ class ESP32Config(models.Model):
detail_image = models.ImageField(upload_to='products/details/', blank=True, null=True, verbose_name="详情页长图 (上传)")
detail_image_url = models.URLField(blank=True, null=True, verbose_name="详情页长图 (URL)", help_text="如果填写了URL将优先使用URL")
static_image_url = models.URLField(blank=True, null=True, verbose_name="产品静态图 (URL)")
model_3d_url = models.URLField(blank=True, null=True, verbose_name="产品3D模型 (URL)", help_text="请上传包含 .obj 模型文件和 .mtl 材质文件的 .zip 压缩包")
model_3d_url = models.URLField(blank=True, null=True, verbose_name="产品3D模型 (URL)")
def __str__(self):
return f"{self.name} - ¥{self.price}"