mirror of
https://github.com/pretix/pretix.git
synced 2026-05-06 15:24:02 +00:00
Make last commit more resilient
This commit is contained in:
@@ -162,7 +162,7 @@ DEFAULT_VARIABLES = OrderedDict((
|
||||
"evaluate": lambda op, order, ev: "<br/>".join([
|
||||
'{} - {}'.format(p.item, p.variation) if p.variation else str(p.item)
|
||||
for p in (
|
||||
op.addons.all() if 'addons' in op._prefetched_objects_cache
|
||||
op.addons.all() if 'addons' in getattr(op, '_prefetched_objects_cache', {})
|
||||
else op.addons.select_related('item', 'variation')
|
||||
)
|
||||
])
|
||||
|
||||
@@ -36,7 +36,7 @@ def register_data(sender, **kwargs):
|
||||
|
||||
def get_answer(op, order, event, question_id):
|
||||
try:
|
||||
if 'answers' in op._prefetched_objects_cache:
|
||||
if 'answers' in getattr(op, '_prefetched_objects_cache', {}):
|
||||
a = [a for a in op.answers.all() if a.question_id == question_id][0]
|
||||
else:
|
||||
a = op.answers.get(question_id=question_id)
|
||||
|
||||
Reference in New Issue
Block a user