Skip to content

Commit

Permalink
Merge pull request EGCETSII#74 from Decide-Part-Rota/Rota1-032
Browse files Browse the repository at this point in the history
Rota1-032
  • Loading branch information
rafestorn authored Dec 11, 2022
2 parents 2d62da3 + 88c9fea commit ae2ea8f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
1 change: 1 addition & 0 deletions decide/census/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
path('add/', views.census_add, name='census_add'),
path('add/add_to_census', views.add_to_census),
path('addUser/<int:voting_id>', views.add_user),
path('deleteUser/<int:voting_id>', views.delete_user_from_census),
path('remove/', views.census_remove, name='census_remove'),
path('remove/remove_from_census', views.remove_from_census),
path('export/', views.export_census),
Expand Down
15 changes: 14 additions & 1 deletion decide/census/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,20 @@ def add_user(request, voting_id):
censo = Census(voting_id = voting_id, voter_id=request.user.id)
censo.save()

messages.error(request, "You must be a staff member to access this page")
#messages.error(request, "You must be a staff member to access this page")
return VotacionList.mostrarVotacionesPublicas(request)

def delete_user_from_census(request, voting_id):

try:
censo = Census.objects.get(voting_id = voting_id, voter_id=request.user.id)
except Census.DoesNotExist:
censo = None

if censo is not None:
censo.delete()

#messages.error(request, "You must be a staff member to access this page")
return VotacionList.mostrarVotacionesPublicas(request)


Expand Down
10 changes: 8 additions & 2 deletions decide/voting/templates/voting/listVoting.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ <h2 style="text-align:center">Listado de Votaciones Públicas</h2>
<td>Name</td>
<td>Description</td>
<td>Visibility</td>
<td></td>
<td>Acciones</td>

</tr>

Expand Down Expand Up @@ -84,7 +84,7 @@ <h4 style="text-align:center">Listado de Votaciones que no participa</h4>
<td>Name</td>
<td>Description</td>
<td>Visibility</td>
<td></td>
<td>Acciones</td>

</tr>

Expand Down Expand Up @@ -113,6 +113,12 @@ <h4 style="text-align:center">Listado de Votaciones en la que participa</h4>

</a>

<a class="boton-personalizado" href="/census/deleteUser/{{votacion.id}}">

Quit Census

</a>

</td>

</tr>
Expand Down

0 comments on commit ae2ea8f

Please sign in to comment.