diff --git a/archivist/apps/sites/templatetags/string_helper.py b/archivist/apps/sites/templatetags/string_helper.py new file mode 100644 index 0000000..92116f8 --- /dev/null +++ b/archivist/apps/sites/templatetags/string_helper.py @@ -0,0 +1,18 @@ +from django import template + +from utils.strings import convert_size + +register = template.Library() + +@register.filter +def size_to_human_readable (size): + """ + A filter that converts the given size to a human-readable format using the utils.strings.convert_size function. + + Parameters: + size: The size to be converted. + + Returns: + The human-readable size format. + """ + return convert_size(size)