SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit affdbd38 authored by George Katsikas's avatar George Katsikas :goat:
Browse files

wip add remove voters from nomination round

parent 228c82d2
No related branches found
No related tags found
1 merge request!58[Fellowship Nominations] Rework the fellowship nomination system and UI
......@@ -5,6 +5,7 @@
<th>Fellow</th>
<th>Vote</th>
<th>Voted on</th>
<th>Actions</th>
</tr>
</thead>
......@@ -29,9 +30,18 @@
{% endif %}
<td>{{ voter.vote.on }}</td>
<td>
{% if not round.is_closed %}
<a class="btn btn-sm btn-danger px-1 py-0 ms-auto">{% include "bi/trash-fill.html" %}</a>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
......
......@@ -11,7 +11,10 @@
{% if "edadmin" in user_roles and not voting_round.is_closed %}
<div class="col-4">
<h4>Add new voter</h4>
bla
<h4>Add senior fellows</h4>
<button type="button" class="mb-2 btn btn-primary btn-sm">With specialty overlap</button>
<button type="button" class="mb-2 btn btn-warning text-white btn-sm">ALL seniors</button>
{{ form }}
</div>
{% endif %}
......
......@@ -921,19 +921,20 @@ def _hx_nomination_voting_rounds_tab(request, nomination_id, round_id):
selected_round = voting_rounds.get(id=round_id)
context["selected_round"] = selected_round
round_start_form = FellowshipNominationVotingRoundStartForm(
request.POST or None,
instance=selected_round,
)
if round_start_form.is_valid():
round_start_form.save()
messages.success(
request,
f"Voting round for {nomination.profile} started "
f"from {selected_round.voting_opens} until {selected_round.voting_deadline}.",
if not round.is_closed():
round_start_form = FellowshipNominationVotingRoundStartForm(
request.POST or None,
instance=selected_round,
)
context["round_start_form"] = round_start_form
if round_start_form.is_valid():
round_start_form.save()
messages.success(
request,
f"Voting round for {nomination.profile} started "
f"from {selected_round.voting_opens} until {selected_round.voting_deadline}.",
)
context["round_start_form"] = round_start_form
return render(request, "colleges/_hx_nomination_voting_rounds_tab.html", context)
......@@ -1254,3 +1255,19 @@ def _hx_nomination_voter_table(request, round_id):
"round": round,
}
return render(request, "colleges/_hx_nomination_voter_table.html", context)
@login_required
@user_passes_test(is_edadmin)
def _hx_nomination_round_eligible_voter_action(
request, round_id, fellowship_id, action
):
round = get_object_or_404(FellowshipNominationVotingRound, pk=round_id)
fellowship = get_object_or_404(Fellowship, pk=fellowship_id)
if action == "add":
round.eligible_to_vote.add(fellowship)
if action == "remove":
round.eligible_to_vote.remove(fellowship)
return redirect(
reverse("colleges:_hx_nomination_voter_table", kwargs={"round_id": round.id})
)
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