Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Findeton committed Mar 28, 2024
1 parent e28634f commit 905bc8e
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion iam/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2353,7 +2353,22 @@ def post(self, request, pk):

class Turnout(View):
def get(self, request, pk):
return 1
permission_required(request.user, 'AuthEvent', 'view', pk)
ae = get_object_or_404(AuthEvent, pk=pk)

ids = [pk]
data = {}
if ae.children_election_info:
ids.extend(ae.children_election_info['natural_order'])

for id in ids:
id_ae = get_object_or_404(AuthEvent, pk=pk)
data[id] = {
'users': id_ae.len_census(),
'total_votes': id_ae.get_num_votes()
}
return json_response(data)

turnout = login_required(Turnout.as_view())

class GetImage(View):
Expand Down

0 comments on commit 905bc8e

Please sign in to comment.