Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jan 9, 2023
1 parent 2308b28 commit 7bf1798
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions auditlog/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
from django.db.models import Q, QuerySet
from django.utils import formats
from django.utils.encoding import smart_str
from django.utils.translation import gettext_lazy as _
from django.utils.text import Truncator
from django.utils.translation import gettext_lazy as _

from auditlog.diff import mask_str

Expand Down Expand Up @@ -468,7 +468,10 @@ def changes_display_dict(self):

if field_type == "ManyToManyField":
values_display = values
values_display['objects'] = [f"{Truncator(i).chars(140,html=True)}..." if len(i) >140 else i for i in values['objects'] ]
values_display["objects"] = [
f"{Truncator(i).chars(140,html=True)}..." if len(i) > 140 else i
for i in values["objects"]
]
verbose_name = model_fields["mapping_fields"].get(
field.name, getattr(field, "verbose_name", field.name)
)
Expand All @@ -492,8 +495,8 @@ def changes_display_dict(self):
pass
# check if length is longer than 140 and truncate with ellipsis
if len(value) > 140:
#value = f"{value[:140]}..."
value=f"{Truncator(value).chars(140,html=True)}..."
# value = f"{value[:140]}..."
value = f"{Truncator(value).chars(140,html=True)}..."

values_display.append(value)
verbose_name = model_fields["mapping_fields"].get(
Expand Down

0 comments on commit 7bf1798

Please sign in to comment.