# 86 Comment field length

* removes comment field length limit
* adds improvements for rendering large comments
This commit is contained in:
2022-02-02 12:54:45 +01:00
parent 1eecc5fa48
commit edad33e662
15 changed files with 91 additions and 27 deletions

View File

@@ -52,3 +52,19 @@ def default_if_zero(val1, val2):
"""
return val1 if val1 > 0 else val2
@register.filter("shorten")
def shorten(val, length):
""" Returns val shortened to the first number of length character
Args:
val (str): The value
length (int): The number of characters left
Returns:
"""
if val is not None and len(val) > length:
val = f"{val[:length]}..."
return val