-
Notifications
You must be signed in to change notification settings - Fork 112
Expand file tree
/
Copy pathdashboard_cospeaking_proposal_table.html
More file actions
56 lines (53 loc) · 1.99 KB
/
dashboard_cospeaking_proposal_table.html
File metadata and controls
56 lines (53 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
{% load i18n %}
<table class="proposals-table table table-responsive">
<thead>
<tr>
<th class="proposal-title">{% trans 'Title' %}</th>
<th width="1%">{% trans 'Language' %}</th>
<th width="1%">{% trans 'Submitter' %}</th>
<th width="1%">{% trans 'Status' %}</th>
<th width="1%"></th>
</tr>
</thead>
<tbody>
{% comment %}
FIXME: This loop has an n+1 problem on "speaker_info.proposal". We can't
do "selected_related" because it's generic, neither "prefetch_related"
because it is (likely) not homogenous.
This likely will not cause problems in practice, however. It's rare for
a user to become a co-speaker in two or more proposals, so n+1 is likely
around 3. Joining will likely require more queries.
We can always come back if this ever become a real problem.
{% endcomment %}
{% for speaker_info in speaker_infos %}
<tr>
<td class="proposal-title"><a href="{{ speaker_info.proposal.get_peek_url }}">{{ speaker_info.proposal.title }}</a></td>
<td>{{ speaker_info.proposal.get_language_display }}</td>
<td>
<a href="mailto: {{ speaker_info.proposal.submitter.email }}">
{{ speaker_info.proposal.submitter.speaker_name }}
</a>
</td>
<td>{{ speaker_info.get_status_display }}</td>
<td>
<form method="post"
action="{% url 'additional_speaker_set_status' pk=speaker_info.pk %}" hidden>
{% csrf_token %}
{% if speaker_info.status != 'accepted' %}
<button type="submit" name="status" value="accepted"
class="btn btn-sm btn-success">
{% trans 'Accept' %}
</button>
{% endif %}
{% if speaker_info.status != 'declined' %}
<button type="submit" name="status" value="declined"
class="btn btn-sm btn-danger">
{% trans 'Decline' %}
</button>
{% endif %}
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>