feat: Export relationships with answers

See #27
See #29
Resolves #25
This commit is contained in:
James Graham
2020-04-01 13:15:48 +01:00
parent 76ae447cc6
commit 76270c4572
3 changed files with 35 additions and 12 deletions

View File

@@ -6,6 +6,7 @@ import typing
from django.db import models
from django.urls import reverse
from django.utils.text import slugify
from .person import Person
@@ -47,6 +48,10 @@ class RelationshipQuestion(models.Model):
return [
[choice.pk, str(choice)] for choice in self.answers.all()
]
@property
def slug(self) -> str:
return slugify(self.text)
def __str__(self) -> str:
return self.text
@@ -80,6 +85,10 @@ class RelationshipQuestionChoice(models.Model):
order = models.SmallIntegerField(default=0,
blank=False, null=False)
@property
def slug(self) -> str:
return slugify(self.text)
def __str__(self) -> str:
return self.text