diff --git a/userManagment/templates/userManagment/createUser.html b/userManagment/templates/userManagment/createUser.html index 8c0b48297..cd79a58e6 100644 --- a/userManagment/templates/userManagment/createUser.html +++ b/userManagment/templates/userManagment/createUser.html @@ -1,5 +1,6 @@ {% extends "baseTemplate/index.html" %} {% load i18n %} +{% load user_filters %} {% block title %}{% trans "Create New User - CyberPanel" %}{% endblock %} {% block content %} diff --git a/userManagment/templatetags/__init__.py b/userManagment/templatetags/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/userManagment/templatetags/user_filters.py b/userManagment/templatetags/user_filters.py new file mode 100644 index 000000000..0cf01136c --- /dev/null +++ b/userManagment/templatetags/user_filters.py @@ -0,0 +1,21 @@ +""" +Custom Django template filters for user management +""" +from django import template +from django.template.defaultfilters import filesizeformat + +register = template.Library() + + +@register.filter(name='filesize') +def filesize_filter(value): + """ + Alias for Django's filesizeformat filter to maintain compatibility + with templates that use |filesize instead of |filesizeformat + """ + if value is None: + return '0 B' + try: + return filesizeformat(value) + except (ValueError, TypeError): + return '0 B' diff --git a/websiteFunctions/templates/websiteFunctions/modifyWebsite.html b/websiteFunctions/templates/websiteFunctions/modifyWebsite.html index ab289504c..28eaa6fcf 100644 --- a/websiteFunctions/templates/websiteFunctions/modifyWebsite.html +++ b/websiteFunctions/templates/websiteFunctions/modifyWebsite.html @@ -1,5 +1,6 @@ {% extends "baseTemplate/index.html" %} {% load i18n %} +{% load website_filters %} {% block title %}{% trans "Modify Website - CyberPanel" %}{% endblock %} {% block header_scripts %} diff --git a/websiteFunctions/templatetags/__init__.py b/websiteFunctions/templatetags/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/websiteFunctions/templatetags/website_filters.py b/websiteFunctions/templatetags/website_filters.py new file mode 100644 index 000000000..0cf01136c --- /dev/null +++ b/websiteFunctions/templatetags/website_filters.py @@ -0,0 +1,21 @@ +""" +Custom Django template filters for user management +""" +from django import template +from django.template.defaultfilters import filesizeformat + +register = template.Library() + + +@register.filter(name='filesize') +def filesize_filter(value): + """ + Alias for Django's filesizeformat filter to maintain compatibility + with templates that use |filesize instead of |filesizeformat + """ + if value is None: + return '0 B' + try: + return filesizeformat(value) + except (ValueError, TypeError): + return '0 B'