mirror of
https://github.com/Southampton-RSG/breccia-mapper.git
synced 2026-03-03 11:27:09 +00:00
style: Fix some autoformatting issues
This commit is contained in:
@@ -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):
|
class RelationshipAnswerSetSerializer(base.FlattenedModelSerializer):
|
||||||
relationship = RelationshipSerializer()
|
relationship = RelationshipSerializer()
|
||||||
|
|
||||||
@@ -64,7 +69,7 @@ class RelationshipAnswerSetSerializer(base.FlattenedModelSerializer):
|
|||||||
|
|
||||||
# Add relationship questions to columns
|
# Add relationship questions to columns
|
||||||
for question in models.RelationshipQuestion.objects.all():
|
for question in models.RelationshipQuestion.objects.all():
|
||||||
headers.append(question.slug.replace('-', '_'))
|
headers.append(underscore(question.slug))
|
||||||
|
|
||||||
return headers
|
return headers
|
||||||
|
|
||||||
@@ -74,9 +79,7 @@ class RelationshipAnswerSetSerializer(base.FlattenedModelSerializer):
|
|||||||
try:
|
try:
|
||||||
# Add relationship question answers to data
|
# Add relationship question answers to data
|
||||||
for answer in instance.question_answers.all():
|
for answer in instance.question_answers.all():
|
||||||
rep[answer.question.slug.replace('-',
|
rep[underscore(answer.question.slug)] = underscore(answer.slug)
|
||||||
'_')] = answer.slug.replace(
|
|
||||||
'-', '_')
|
|
||||||
|
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
|
|||||||
Reference in New Issue
Block a user