[FIX] Check if the CustomCSS object exists

This commit is contained in:
Peter Pfeufer 2024-08-14 13:22:23 +02:00
parent 3c2c137dad
commit 710149ec21
No known key found for this signature in database
GPG Key ID: 6051D2C6AD4EBC27

View File

@ -33,7 +33,12 @@ def custom_css_static(path: str) -> str:
except FileNotFoundError: except FileNotFoundError:
return "" return ""
else: else:
custom_css_changed = CustomCSS.objects.first().timestamp.timestamp() try:
custom_css = CustomCSS.objects.get(pk=1)
except CustomCSS.DoesNotExist:
return ""
else:
custom_css_changed = custom_css.timestamp.timestamp()
custom_css_version = ( custom_css_version = (
str(custom_css_changed).replace(" ", "").replace(":", "").replace("-", "") str(custom_css_changed).replace(" ", "").replace(":", "").replace("-", "")
) # remove spaces, colons, and dashes ) # remove spaces, colons, and dashes