mirror of
https://github.com/pretix/pretix.git
synced 2026-05-03 14:54:04 +00:00
API: Fix selecting checkin question answers by option identifier
This commit is contained in:
@@ -1116,10 +1116,13 @@ class Question(LoggedModel):
|
||||
return None
|
||||
|
||||
if self.type == Question.TYPE_CHOICE:
|
||||
try:
|
||||
return self.options.get(Q(pk=answer) | Q(identifier=answer))
|
||||
except:
|
||||
q = Q(identifier=answer)
|
||||
if answer.isdigit():
|
||||
q |= Q(pk=answer)
|
||||
o = self.options.filter(q).first()
|
||||
if not o:
|
||||
raise ValidationError(_('Invalid option selected.'))
|
||||
return o
|
||||
elif self.type == Question.TYPE_CHOICE_MULTIPLE:
|
||||
if isinstance(answer, str):
|
||||
l_ = list(self.options.filter(
|
||||
|
||||
Reference in New Issue
Block a user