mirror of
https://github.com/jazzband/django-auditlog.git
synced 2026-05-05 06:04:44 +00:00
11 lines
241 B
Python
11 lines
241 B
Python
class Truncator:
|
|
|
|
def __init__(self, text) -> None:
|
|
self.text = text
|
|
|
|
def chars(self, length: int) -> str:
|
|
return f"{self.text[:length]}..."
|
|
|
|
|
|
def truncatechars(text, length):
|
|
return Truncator(text).chars(length)
|