additional option for 'samechoicesas'

dj111py38
Jamie Campbell 2015-11-29 02:46:08 -06:00
parent 667752d60b
commit a7088c2586
1 changed files with 9 additions and 1 deletions

View File

@ -345,7 +345,15 @@ class Question(models.Model):
def choices(self): def choices(self):
if self.type == 'sameas': if self.type == 'sameas':
return self.sameas().choices() return self.sameas().choices()
res = Choice.objects.filter(question=self).order_by('sortid')
res = None
if 'samechoicesas' in parse_checks(self.checks):
number_to_grab_from = parse_checks(self.checks)['samechoicesas']
choicesource = Question.objects.get(number=number_to_grab_from)
if not choicesource == None:
res = Choice.objects.filter(question=choicesource).order_by('sortid')
else:
res = Choice.objects.filter(question=self).order_by('sortid')
return res return res
def is_custom(self): def is_custom(self):