Skip to content
Snippets Groups Projects
Commit 1d31e165 authored by Felix Schäfer's avatar Felix Schäfer :construction_worker:
Browse files

Show answers to public questions

parent 89122595
No related branches found
No related tags found
No related merge requests found
......@@ -48,17 +48,33 @@ def add_public_registrations_table(sender, **kwargs):
cached = sender.cache.get('public_registrations_table_' + get_language())
if cached is None:
cached = ""
headers = ["Name"]
public_questions = [
q for q in sender.questions.all()
if str(q.pk) in sender.settings.get('public_registrations_questions')
]
headers = [_("Name")] + [
q.question for q in public_questions
]
order_positions = OrderPosition.objects.filter(order__event=sender)
public_order_positions = [
op for op in order_positions
if op.meta_info_data.get('question_form_data', {}).get('public_registration') == "True"
and str(op.item.pk) in sender.settings.get('public_registrations_items')
]
public_answers = {
pop: {
pq: pop.answers.filter(question=pq).first()
}
for pq in public_questions
for pop in public_order_positions
}
public_registrations = [
{
'gr_url': get_gravatar_url(pop.attendee_email, size=24, default="wavatar"),
'fields': [pop.attendee_name_cached]
'fields': [pop.attendee_name_cached] + [
public_answers[pop][pq].answer if public_answers[pop][pq] else ''
for pq in public_questions
]
} for pop in public_order_positions if pop.attendee_email and pop.attendee_name_cached
]
template = get_template('pretix_public_registrations/front_page.html')
......
......@@ -7,7 +7,7 @@
<tr>
<th scope="col" class="sorttable_nosort"></th>
{% for h in headers %}
<th scope="col">{% trans h %} <i class="fa fa-caret-up"></i><i class="fa fa-caret-down"></i></th>
<th scope="col">{{ h }} <i class="fa fa-caret-up"></i><i class="fa fa-caret-down"></i></th>
{% endfor %}
</tr>
</thead>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment