From bcb3dedc36cb9efc5d1935d596b20facff1b45ba Mon Sep 17 00:00:00 2001 From: Aroy-Art Date: Thu, 14 Mar 2024 22:41:30 +0100 Subject: [PATCH] Add: MIME type & file extension fields --- archivist/apps/files/models.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/archivist/apps/files/models.py b/archivist/apps/files/models.py index 376e691..05c4f1d 100644 --- a/archivist/apps/files/models.py +++ b/archivist/apps/files/models.py @@ -23,9 +23,11 @@ def get_upload_to_banner(instance, filename): class User_Profile_Images(models.Model): - file_hash = models.CharField(unique=True, max_length=64,) + file_hash = models.CharField(unique=True, max_length=64) file_name = models.CharField(max_length=150, blank=True) file = models.FileField(upload_to=get_upload_to_profile, blank=True) + file_mime = models.CharField(max_length=64, blank=True) + file_ext = models.CharField(max_length=64, blank=True) date_added = models.DateTimeField(auto_now_add=True, editable=True) class Meta: @@ -41,9 +43,11 @@ class User_Profile_Images(models.Model): class User_Banner_Images(models.Model): - file_hash = models.CharField(unique=True, max_length=64,) + file_hash = models.CharField(unique=True, max_length=64) file_name = models.CharField(max_length=150, blank=True) file = models.FileField(upload_to=get_upload_to_banner, blank=True) + file_mime = models.CharField(max_length=64, blank=True) + file_ext = models.CharField(max_length=64, blank=True) date_added = models.DateTimeField(auto_now_add=True, editable=True) class Meta: @@ -59,9 +63,11 @@ class User_Banner_Images(models.Model): class Submission_File(models.Model): - file_hash = models.CharField(unique=True, max_length=64,) + file_hash = models.CharField(unique=True, max_length=64) file_name = models.CharField(max_length=150, blank=True) file = models.FileField(upload_to=get_upload_to_submission, blank=True) + file_mime = models.CharField(max_length=64, blank=True) + file_ext = models.CharField(max_length=64, blank=True) date_added = models.DateTimeField(auto_now_add=True, editable=True) class Meta: @@ -77,9 +83,11 @@ class Submission_File(models.Model): class Metadata_Files(models.Model): - file_hash = models.CharField(unique=True, max_length=64,) + file_hash = models.CharField(unique=True, max_length=64) file_name = models.CharField(max_length=150, blank=True) file = models.FileField(upload_to=get_upload_to_metadata, blank=True) + file_mime = models.CharField(max_length=64, blank=True) + file_ext = models.CharField(max_length=64, blank=True) date_added = models.DateTimeField(auto_now_add=True, editable=True) class Meta: