Add: thumbnail fields to the PostFile model

This commit is contained in:
Aroy-Art 2025-02-26 14:06:07 +01:00
parent f783d29202
commit 4d4c1c7e11
Signed by: Aroy
GPG key ID: 583642324A1D2070
2 changed files with 10 additions and 0 deletions

View file

@ -1,3 +1,4 @@
from itertools import count
from typing import Dict, List, Optional
from rest_framework import serializers

View file

@ -10,6 +10,10 @@ def get_upload_to_posts(instance, filename):
return get_upload_to(instance, filename, "posts")
def get_upload_to_thumbnails(instance, filename):
return get_upload_to(instance, filename, "thumbnails")
class FileNameModel(models.Model):
filename = models.CharField(max_length=512)
@ -46,6 +50,11 @@ class PostFileModel(models.Model):
manual_added = models.BooleanField(default=False)
# Thumbnails for video file and others
thumbnail = models.FileField(upload_to=get_upload_to_thumbnails, blank=True)
thumbnail_hash_blake3 = models.CharField(max_length=128, blank=True)
thumbnail_blur_hash = models.CharField(max_length=64, blank=True)
class Meta:
verbose_name = "Post File"
verbose_name_plural = "Post Files"