Suppress rendering of binary data - thanks @russss (#442)

Binary columns (including spatialite geographies) get shown as ugly
binary strings in the HTML by default. Nobody wants to see that mess.

Show the size of the column in bytes instead. If you want to decode
the binary data, you can use a plugin to do it.
This commit is contained in:
Russ Garrett 2019-05-03 17:44:48 +01:00 committed by Simon Willison
commit d555baf508

View file

@ -120,6 +120,8 @@ class RowTableShared(BaseView):
)
if plugin_display_value is not None:
display_value = plugin_display_value
elif isinstance(value, bytes):
display_value = jinja2.Markup("<{}&nbsp;bytes>".format(len(value)))
elif isinstance(value, dict):
# It's an expanded foreign key - display link to other row
label = value["label"]