Make last commit more resilient

This commit is contained in:
Raphael Michel
2018-09-25 18:20:40 +02:00
parent feb262644e
commit 6e53990845
2 changed files with 2 additions and 2 deletions

View File

@@ -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)