From f67c3c53aea19a171ede3311fffd15b23aa95049 Mon Sep 17 00:00:00 2001 From: James Date: Thu, 17 Nov 2022 16:44:01 +0000 Subject: [PATCH] jsonschema_validation: Quotes around string values https://github.com/Open-Telecoms-Data/cove-ofds/issues/22 --- .../cove_ofds/jsonschema_validation_table.html | 3 ++- cove_ofds/templatetags/__init__.py | 0 cove_ofds/templatetags/ofds_cove_tags.py | 11 +++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 cove_ofds/templatetags/__init__.py create mode 100644 cove_ofds/templatetags/ofds_cove_tags.py diff --git a/cove_ofds/templates/cove_ofds/jsonschema_validation_table.html b/cove_ofds/templates/cove_ofds/jsonschema_validation_table.html index 5b7db27..ca451a4 100644 --- a/cove_ofds/templates/cove_ofds/jsonschema_validation_table.html +++ b/cove_ofds/templates/cove_ofds/jsonschema_validation_table.html @@ -1,5 +1,6 @@ {% load i18n %} {% load cove_tags %} +{% load ofds_cove_tags %} @@ -37,7 +38,7 @@ {% if col_instance %} {% endif %} {% if col_validator_value %} diff --git a/cove_ofds/templatetags/__init__.py b/cove_ofds/templatetags/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/cove_ofds/templatetags/ofds_cove_tags.py b/cove_ofds/templatetags/ofds_cove_tags.py new file mode 100644 index 0000000..178dfa4 --- /dev/null +++ b/cove_ofds/templatetags/ofds_cove_tags.py @@ -0,0 +1,11 @@ +from django import template + +register = template.Library() + + +@register.filter(name="error_instance_display") +def error_instance_display(input): + if isinstance(input, str): + return '"' + input + '"' + else: + return str(input)
- {{ error.instance }} + {{ error.instance|error_instance_display }}