mirror of
https://github.com/pretix/pretix.git
synced 2026-05-10 16:04:02 +00:00
Localize the answers to boolean questions
This commit is contained in:
@@ -288,6 +288,14 @@ class QuestionAnswer(models.Model):
|
|||||||
)
|
)
|
||||||
answer = models.TextField()
|
answer = models.TextField()
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
if self.question.type == Question.TYPE_BOOLEAN and self.answer == "True":
|
||||||
|
return str(_("Yes"))
|
||||||
|
elif self.question.type == Question.TYPE_BOOLEAN and self.answer == "False":
|
||||||
|
return str(_("No"))
|
||||||
|
else:
|
||||||
|
return self.answer
|
||||||
|
|
||||||
|
|
||||||
class AbstractPosition(models.Model):
|
class AbstractPosition(models.Model):
|
||||||
"""
|
"""
|
||||||
@@ -354,7 +362,7 @@ class AbstractPosition(models.Model):
|
|||||||
"""
|
"""
|
||||||
self.answ = {}
|
self.answ = {}
|
||||||
for a in self.answers.all():
|
for a in self.answers.all():
|
||||||
self.answ[a.question_id] = a.answer
|
self.answ[a.question_id] = a
|
||||||
self.questions = []
|
self.questions = []
|
||||||
for q in self.item.questions.all():
|
for q in self.item.questions.all():
|
||||||
if q.id in self.answ:
|
if q.id in self.answ:
|
||||||
|
|||||||
Reference in New Issue
Block a user