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 Oct 5, 2022
1 parent 669a04f commit 3797dbf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
5 changes: 0 additions & 5 deletions auditlog/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class LogEntryAdminMixin:
def created(self, obj):
return localtime(obj.timestamp)


@admin.display(description="User")
def user_url(self, obj):
if obj.actor:
Expand All @@ -35,7 +34,6 @@ def user_url(self, obj):

return "system"


@admin.display(description="Resource")
def resource_url(self, obj):
app_label, model = obj.content_type.app_label, obj.content_type.model
Expand All @@ -50,7 +48,6 @@ def resource_url(self, obj):
'<a href="{}">{} - {}</a>', link, obj.content_type, obj.object_repr
)


@admin.display(description="Changes")
def msg_short(self, obj):
if obj.action == LogEntry.Action.DELETE:
Expand All @@ -63,7 +60,6 @@ def msg_short(self, obj):
fields = fields[:i] + " .."
return "%d change%s: %s" % (len(changes), s, fields)


@admin.display(description="Changes")
def msg(self, obj):
changes = json.loads(obj.changes)
Expand Down Expand Up @@ -116,7 +112,6 @@ def msg(self, obj):

return mark_safe("".join(msg))


def _format_header(self, *labels):
return format_html(
"".join(["<tr>", "<th>{}</th>" * len(labels), "</tr>"]), *labels
Expand Down
4 changes: 2 additions & 2 deletions auditlog_tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1293,8 +1293,8 @@ def test_created_timezone(self):
("America/Buenos_Aires", "2022-08-01 09:00:00"),
("Asia/Kathmandu", "2022-08-01 17:45:00"),
]:
with self.settings(TIME_ZONE=tz):
created = self.admin.created(log_entry)
with self.settings(TIME_ZONE=tz):
created = self.admin.created(log_entry)
self.assertEqual(created.strftime("%Y-%m-%d %H:%M:%S"), timestamp)


Expand Down

0 comments on commit 3797dbf

Please sign in to comment.