Auto delete image files when object has been deleted

This commit is contained in:
2025-04-10 10:35:17 +02:00
parent 3e61560875
commit 0f961c71e0
2 changed files with 16 additions and 5 deletions

View File

@ -1,4 +1,4 @@
# Generated by Django 4.2.20 on 2025-04-06 09:55
# Generated by Django 4.2.20 on 2025-04-10 08:14
import django.db.models.deletion
from django.conf import settings
@ -25,7 +25,14 @@ class Migration(migrations.Migration):
),
("uuid", models.UUIDField(db_index=True, unique=True)),
("name", models.CharField(max_length=100)),
("image", models.ImageField(upload_to="upload/%Y/%m/%d")),
(
"image",
models.ImageField(
height_field="height",
upload_to="upload/%Y/%m/%d",
width_field="width",
),
),
(
"created_at",
models.DateTimeField(auto_now_add=True, verbose_name="created at"),