From 8f494e1be57d92757e2f099b13978c9659af4d84 Mon Sep 17 00:00:00 2001 From: James Graham Date: Thu, 2 Apr 2020 15:42:48 +0100 Subject: [PATCH] fix: Use underscores in export column headers Resolves #30 --- export/serializers/people.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/export/serializers/people.py b/export/serializers/people.py index baed3bb..8c84ccb 100644 --- a/export/serializers/people.py +++ b/export/serializers/people.py @@ -48,7 +48,7 @@ class RelationshipSerializer(base.FlattenedModelSerializer): # Add relationship questions to columns for question in models.RelationshipQuestion.objects.all(): - headers.append(question.slug) + headers.append(question.slug.replace('-', '_')) return headers @@ -58,7 +58,7 @@ class RelationshipSerializer(base.FlattenedModelSerializer): try: # Add relationship question answers to data for answer in instance.current_answers.question_answers.all(): - rep[answer.question.slug] = answer.slug + rep[answer.question.slug.replace('-', '_')] = answer.slug.replace('-', '_') except AttributeError: pass