Add: thumbnail fields to the PostFile model
This commit is contained in:
parent
f783d29202
commit
4d4c1c7e11
2 changed files with 10 additions and 0 deletions
|
@ -1,3 +1,4 @@
|
|||
from itertools import count
|
||||
from typing import Dict, List, Optional
|
||||
from rest_framework import serializers
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Add table
Reference in a new issue