From b5b6ecc813ea1189fc783b7e6b7142cb8759a3b0 Mon Sep 17 00:00:00 2001 From: Christopher Broderick Date: Tue, 13 May 2025 17:06:47 +0100 Subject: [PATCH] Change DEFAULT_FILE_STORAGE to STORAGES for Django 5 --- helpdesk/models.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/helpdesk/models.py b/helpdesk/models.py index 51a028ac..f1330d8a 100644 --- a/helpdesk/models.py +++ b/helpdesk/models.py @@ -1274,10 +1274,7 @@ class FollowUpAttachment(Attachment): id_=self.followup.id, ) att_path = os.path.join(settings.MEDIA_ROOT, path) - if ( - settings.DEFAULT_FILE_STORAGE - == "django.core.files.storage.FileSystemStorage" - ): + if settings.STORAGES == "django.core.files.storage.FileSystemStorage": if not os.path.exists(att_path): os.makedirs(att_path, helpdesk_settings.HELPDESK_ATTACHMENT_DIR_PERMS) return os.path.join(path, filename) @@ -1295,10 +1292,7 @@ class KBIAttachment(Attachment): category=self.kbitem.category, kbi=self.kbitem.id ) att_path = os.path.join(settings.MEDIA_ROOT, path) - if ( - settings.DEFAULT_FILE_STORAGE - == "django.core.files.storage.FileSystemStorage" - ): + if settings.STORAGES == "django.core.files.storage.FileSystemStorage": if not os.path.exists(att_path): os.makedirs(att_path, helpdesk_settings.HELPDESK_ATTACHMENT_DIR_PERMS) return os.path.join(path, filename) @@ -2128,6 +2122,8 @@ class CustomField(models.Model): attributes["max_digits"] = self.max_length elif self.data_type == "list": attributes["choices"] = self.get_choices() + # elif self.data_type == "datetime": + # attributes["default_timezone"] = getattr(settings, "DEFAULT_TIMEZONE", "UTC") try: return customfield_to_api_field_dict[self.data_type](**attributes)