diff --git a/cove_ofds/templates/cove_ofds/additional_checks_table.html b/cove_ofds/templates/cove_ofds/additional_checks_table.html index bdcd31f..5ae1db7 100644 --- a/cove_ofds/templates/cove_ofds/additional_checks_table.html +++ b/cove_ofds/templates/cove_ofds/additional_checks_table.html @@ -34,7 +34,7 @@

{{ additional_check.path }} - {{ additional_check.missing_node_id }} + {% include "libcoveweb2/show_json_value.html" with value=additional_check.missing_node_id %} {% endfor %} @@ -50,7 +50,7 @@

{{ additional_check.path }} - {{ additional_check.missing_node_id }} + {% include "libcoveweb2/show_json_value.html" with value=additional_check.missing_node_id %} {% endfor %} @@ -90,7 +90,7 @@

{{ additional_check.path }} - {{ additional_check.incorrect_type }} + {% include "libcoveweb2/show_json_value.html" with value=additional_check.incorrect_type %} {% endfor %} @@ -130,7 +130,7 @@

{{ additional_check.path }} - {{ additional_check.incorrect_coordinates }} + {% include "libcoveweb2/show_json_value.html" with value=additional_check.incorrect_coordinates %} {% endfor %} @@ -170,7 +170,7 @@

{{ additional_check.path }} - {{ additional_check.incorrect_type }} + {% include "libcoveweb2/show_json_value.html" with value=additional_check.incorrect_type %} {% endfor %} @@ -210,7 +210,7 @@

{{ additional_check.path }} - {{ additional_check.incorrect_coordinates }} + {% include "libcoveweb2/show_json_value.html" with value=additional_check.incorrect_coordinates %} {% endfor %} @@ -251,7 +251,7 @@

{{ additional_check.path }} - {{ additional_check.phase_id_not_found }} + {% include "libcoveweb2/show_json_value.html" with value=additional_check.phase_id_not_found %} {% endfor %} @@ -281,7 +281,7 @@

{{ additional_check.path }} - {{ additional_check.phase_id_not_found }} + {% include "libcoveweb2/show_json_value.html" with value=additional_check.phase_id_not_found %} {% endfor %} @@ -311,7 +311,7 @@

{{ additional_check.path }} - {{ additional_check.phase_id_not_found }} + {% include "libcoveweb2/show_json_value.html" with value=additional_check.phase_id_not_found %} {% endfor %} @@ -356,10 +356,10 @@

{{ additional_check.path }} - {{ additional_check.name_in_reference }} + {% include "libcoveweb2/show_json_value.html" with value=additional_check.name_in_reference %} - {{ additional_check.name_should_be }} + {% include "libcoveweb2/show_json_value.html" with value=additional_check.name_should_be %} {% endfor %} @@ -390,10 +390,10 @@

{{ additional_check.path }} - {{ additional_check.name_in_reference }} + {% include "libcoveweb2/show_json_value.html" with value=additional_check.name_in_reference %} - {{ additional_check.name_should_be }} + {% include "libcoveweb2/show_json_value.html" with value=additional_check.name_should_be %} {% endfor %} @@ -424,10 +424,10 @@

{{ additional_check.path }} - {{ additional_check.name_in_reference }} + {% include "libcoveweb2/show_json_value.html" with value=additional_check.name_in_reference %} - {{ additional_check.name_should_be }} + {% include "libcoveweb2/show_json_value.html" with value=additional_check.name_should_be %} {% endfor %} @@ -469,7 +469,7 @@

{{ additional_check.path }} - {{ additional_check.organisation_id_not_found }} + {% include "libcoveweb2/show_json_value.html" with value=additional_check.organisation_id_not_found %} {% endfor %} @@ -499,7 +499,7 @@

{{ additional_check.path }} - {{ additional_check.organisation_id_not_found }} + {% include "libcoveweb2/show_json_value.html" with value=additional_check.organisation_id_not_found %} {% endfor %} @@ -529,7 +529,7 @@

{{ additional_check.path }} - {{ additional_check.organisation_id_not_found }} + {% include "libcoveweb2/show_json_value.html" with value=additional_check.organisation_id_not_found %} {% endfor %} @@ -577,10 +577,10 @@

{{ additional_check.path }} - {{ additional_check.name_in_reference }} + {% include "libcoveweb2/show_json_value.html" with value=additional_check.name_in_reference %} - {{ additional_check.name_should_be }} + {% include "libcoveweb2/show_json_value.html" with value=additional_check.name_should_be %} {% endfor %} @@ -615,10 +615,10 @@

{{ additional_check.path }} - {{ additional_check.name_in_reference }} + {% include "libcoveweb2/show_json_value.html" with value=additional_check.name_in_reference %} - {{ additional_check.name_should_be }} + {% include "libcoveweb2/show_json_value.html" with value=additional_check.name_should_be %} {% endfor %} @@ -649,10 +649,10 @@

{{ additional_check.path }} - {{ additional_check.name_in_reference }} + {% include "libcoveweb2/show_json_value.html" with value=additional_check.name_in_reference %} - {{ additional_check.name_should_be }} + {% include "libcoveweb2/show_json_value.html" with value=additional_check.name_should_be %} {% endfor %} diff --git a/cove_ofds/templates/cove_ofds/jsonschema_validation_table.html b/cove_ofds/templates/cove_ofds/jsonschema_validation_table.html index c4aaa8f..2daf8a4 100644 --- a/cove_ofds/templates/cove_ofds/jsonschema_validation_table.html +++ b/cove_ofds/templates/cove_ofds/jsonschema_validation_table.html @@ -1,6 +1,5 @@ {% load i18n %} {% load cove_tags %} -{% load ofds_cove_tags %}
@@ -39,12 +38,12 @@ {% if col_instance %} {% endif %} {% if col_validator_value %} {% endif %} diff --git a/cove_ofds/templatetags/__init__.py b/cove_ofds/templatetags/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/cove_ofds/templatetags/ofds_cove_tags.py b/cove_ofds/templatetags/ofds_cove_tags.py deleted file mode 100644 index 178dfa4..0000000 --- a/cove_ofds/templatetags/ofds_cove_tags.py +++ /dev/null @@ -1,11 +0,0 @@ -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) diff --git a/libcoveweb2/templates/libcoveweb2/additional_fields_table.html b/libcoveweb2/templates/libcoveweb2/additional_fields_table.html index 98b3e7f..0f80b5d 100644 --- a/libcoveweb2/templates/libcoveweb2/additional_fields_table.html +++ b/libcoveweb2/templates/libcoveweb2/additional_fields_table.html @@ -20,7 +20,7 @@ diff --git a/libcoveweb2/templates/libcoveweb2/show_json_value.html b/libcoveweb2/templates/libcoveweb2/show_json_value.html new file mode 100644 index 0000000..98cba3d --- /dev/null +++ b/libcoveweb2/templates/libcoveweb2/show_json_value.html @@ -0,0 +1,7 @@ +{% load cove_tags %} + +{% if value|get_variable_type == 'str' %} + "{{ value }}" +{% else %} + {{ value }} +{% endif %} diff --git a/libcoveweb2/templatetags/cove_tags.py b/libcoveweb2/templatetags/cove_tags.py index 05cb9f9..0cbff92 100644 --- a/libcoveweb2/templatetags/cove_tags.py +++ b/libcoveweb2/templatetags/cove_tags.py @@ -64,3 +64,8 @@ def take_or_sample(population, k): @register.filter(name="list_from_attribute") def list_from_attribute(list_of_dicts, key_name): return [value[key_name] for value in list_of_dicts] + + +@register.filter(name="get_variable_type") +def get_variable_type(value): + return type(value).__name__
- {{ error.instance|error_instance_display }} + {% include "libcoveweb2/show_json_value.html" with value=error.instance %} - {{ error.validator_value }} + {% include "libcoveweb2/show_json_value.html" with value=error.validator_value %}
{{info.count}} {% for example in info.examples %} - {{example}}
+ {% include "libcoveweb2/show_json_value.html" with value=example %}
{% endfor %}
@@ -64,7 +64,7 @@

{% blocktrans %}Child fields of {{parent_full_path}}{% endblocktrans %}

{{info.count}}
{% for example in info.examples %} - {{example}}
+ {% include "libcoveweb2/show_json_value.html" with value=example %}
{% endfor %}