mirror of
https://github.com/bugsink/bugsink.git
synced 2026-02-11 00:09:56 -06:00
13 lines
289 B
Python
13 lines
289 B
Python
from django.utils.encoding import smart_str
|
|
|
|
|
|
def truncatechars(value: str, chars=100):
|
|
"""Truncate string and append …"""
|
|
return (value[:chars] + "…") if len(value) > chars else value
|
|
|
|
|
|
def strip(value):
|
|
if not value:
|
|
return ""
|
|
return smart_str(value).strip()
|