From fb4059d8330e8f972874ec6ba562e4b5d7c9363f Mon Sep 17 00:00:00 2001 From: Brian Duncan Date: Thu, 19 Sep 2024 12:03:16 -0500 Subject: [PATCH] Fix bug while swapping file in UploadNamedFileWidget (#610) * Fix bug while swapping file in UploadNamedFileWidget * fix spacing --- CHANGES.md | 2 +- castle/cms/widgets.py | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 39aeb3764..6d36986ee 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,7 +4,7 @@ Changelog 3.0.0b143 (unreleased) ---------------------- -- Nothing changed yet. +- Fix bug while swapping file in UploadNamedFileWidget 3.0.0b142 (2024-09-18) diff --git a/castle/cms/widgets.py b/castle/cms/widgets.py index deede71c1..69b396c26 100644 --- a/castle/cms/widgets.py +++ b/castle/cms/widgets.py @@ -829,6 +829,20 @@ class UploadNamedFileWidget(NamedFileWidget): klass = NamedFileWidget.klass + ' pat-upload-update' replacement = False + @property + def file_content_type(self): + try: + return super(UploadNamedFileWidget, self).file_content_type + except Exception: + return None + + @property + def file_icon(self): + try: + return super(UploadNamedFileWidget, self).file_icon + except Exception: + return None + @property def pattern_options(self): return json.dumps({