Fix pretty logs admin for orders with no logs recorded

This commit is contained in:
Reckless_Satoshi 2023-08-19 11:24:14 -07:00
parent 13806b8183
commit 4e7963c90d
No known key found for this signature in database
GPG Key ID: 9C4585B561315571

View File

@ -129,6 +129,8 @@ class OrderAdmin(AdminChangeLinksMixin, admin.ModelAdmin):
readonly_fields = ("reference", "_logs") readonly_fields = ("reference", "_logs")
def _logs(self, obj): def _logs(self, obj):
if not obj.logs:
return format_html("<b>No logs were recorded</b>")
with_hyperlinks = objects_to_hyperlinks(obj.logs) with_hyperlinks = objects_to_hyperlinks(obj.logs)
return format_html(f'<table style="width: 100%">{with_hyperlinks}</table>') return format_html(f'<table style="width: 100%">{with_hyperlinks}</table>')