mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2025-07-09 12:30:15 +02:00
[FIX] Check if the CustomCSS object exists
This commit is contained in:
parent
3c2c137dad
commit
710149ec21
@ -33,11 +33,16 @@ 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_version = (
|
custom_css = CustomCSS.objects.get(pk=1)
|
||||||
str(custom_css_changed).replace(" ", "").replace(":", "").replace("-", "")
|
except CustomCSS.DoesNotExist:
|
||||||
) # remove spaces, colons, and dashes
|
return ""
|
||||||
static_url = static(path)
|
else:
|
||||||
versioned_url = static_url + "?v=" + custom_css_version
|
custom_css_changed = custom_css.timestamp.timestamp()
|
||||||
|
custom_css_version = (
|
||||||
|
str(custom_css_changed).replace(" ", "").replace(":", "").replace("-", "")
|
||||||
|
) # remove spaces, colons, and dashes
|
||||||
|
static_url = static(path)
|
||||||
|
versioned_url = static_url + "?v=" + custom_css_version
|
||||||
|
|
||||||
return mark_safe(f'<link rel="stylesheet" href="{versioned_url}">')
|
return mark_safe(f'<link rel="stylesheet" href="{versioned_url}">')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user