Add: template tag for size_to_human_readable

This commit is contained in:
Aroy-Art 2024-04-29 21:05:43 +02:00
parent cc104c1292
commit 846b029f70
Signed by: Aroy
GPG key ID: DB9689E9391DD156

View file

@ -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)