diff --git a/breccia_mapper/templates/base.html b/breccia_mapper/templates/base.html index b69fd7b..5eea059 100644 --- a/breccia_mapper/templates/base.html +++ b/breccia_mapper/templates/base.html @@ -28,13 +28,13 @@ {% if 'javascript_in_head'|bootstrap_setting %} - {% if 'include_jquery'|bootstrap_setting %} - {# jQuery JavaScript if it is in head #} - {% bootstrap_jquery jquery='include_jquery'|bootstrap_setting %} - {% endif %} + {% if 'include_jquery'|bootstrap_setting %} + {# jQuery JavaScript if it is in head #} + {% bootstrap_jquery jquery='include_jquery'|bootstrap_setting %} + {% endif %} - {# Bootstrap JavaScript if it is in head #} - {% bootstrap_javascript %} + {# Bootstrap JavaScript if it is in head #} + {% bootstrap_javascript %} {% endif %} {% if form %} @@ -48,104 +48,104 @@
{% block navbar %} - + {% endblock %} {# Global banner if config.NOTICE_TEXT is set using Constance #} {% if config.NOTICE_TEXT %} - + {% endif %} {% if request.user.is_authenticated and not request.user.has_person %} - {% endif %} {% block before_content %}{% endblock %} @@ -169,13 +169,13 @@ {% if not 'javascript_in_head'|bootstrap_setting %} - {% if 'include_jquery'|bootstrap_setting %} - {# jQuery JavaScript if it is in body #} - {% bootstrap_jquery jquery='include_jquery'|bootstrap_setting %} - {% endif %} + {% if 'include_jquery'|bootstrap_setting %} + {# jQuery JavaScript if it is in body #} + {% bootstrap_jquery jquery='include_jquery'|bootstrap_setting %} + {% endif %} - {# Bootstrap JavaScript if it is in body #} - {% bootstrap_javascript %} + {# Bootstrap JavaScript if it is in body #} + {% bootstrap_javascript %} {% endif %} {% if form %} diff --git a/export/serializers/people.py b/export/serializers/people.py index b9308b2..872761b 100644 --- a/export/serializers/people.py +++ b/export/serializers/people.py @@ -46,6 +46,11 @@ class RelationshipSerializer(base.FlattenedModelSerializer): ] +def underscore(slug: str) -> str: + """Replace hyphens with underscores in text.""" + return slug.replace('-', '_') + + class RelationshipAnswerSetSerializer(base.FlattenedModelSerializer): relationship = RelationshipSerializer() @@ -64,7 +69,7 @@ class RelationshipAnswerSetSerializer(base.FlattenedModelSerializer): # Add relationship questions to columns for question in models.RelationshipQuestion.objects.all(): - headers.append(question.slug.replace('-', '_')) + headers.append(underscore(question.slug)) return headers @@ -74,9 +79,7 @@ class RelationshipAnswerSetSerializer(base.FlattenedModelSerializer): try: # Add relationship question answers to data for answer in instance.question_answers.all(): - rep[answer.question.slug.replace('-', - '_')] = answer.slug.replace( - '-', '_') + rep[underscore(answer.question.slug)] = underscore(answer.slug) except AttributeError: pass