Allow empty plugin responses (#1056)

While plugin developers are supposed to return an empty dictionary, it's
conceivable that they might just put in a `return` if their field is not
needed, and pretix being generous about this would be cool.
This commit is contained in:
Tobias Kunze
2018-10-30 10:11:39 +01:00
committed by Raphael Michel
parent 9647cc6cf2
commit 3bf3ff1ee2
2 changed files with 12 additions and 10 deletions

View File

@@ -173,11 +173,12 @@ class OrderDetail(OrderView):
p.additional_fields = []
data = p.meta_info_data
for r, response in sorted(responses, key=lambda r: str(r[0])):
for key, value in response.items():
p.additional_fields.append({
'answer': data.get('question_form_data', {}).get(key),
'question': value.label
})
if response:
for key, value in response.items():
p.additional_fields.append({
'answer': data.get('question_form_data', {}).get(key),
'question': value.label
})
p.has_questions = (
p.additional_fields or