From 3f7127347b21991be22f3b8a480b8512a13a919d Mon Sep 17 00:00:00 2001 From: corbz Date: Sun, 21 Jan 2024 22:53:00 +0000 Subject: [PATCH] Increased Ticket.short_description length to 200 Previously 150. I also added a check to see if 200 is exceeded before suffixing the "..." to it. --- apps/home/models.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/home/models.py b/apps/home/models.py index 364bcb1..5ab3b1c 100644 --- a/apps/home/models.py +++ b/apps/home/models.py @@ -106,8 +106,11 @@ class Ticket(models.Model): def short_description(self): """Provide a snippet of the description for presentation purposes.""" - short_description = bleach.clean(self.description, tags=[])[:150] - return f"{short_description}..." + short_description = bleach.clean(self.description, tags=[]) + if len(short_description) > 200: + return f"{short_description[:200]}..." + + return short_description def save(self, *args, **kwargs): """Override the save method to clean the description and apply timestamps."""