#58 Voting UI is bugged when no vote was submitted

This commit is contained in:
2021-12-31 15:56:31 +01:00
parent 1de203ad40
commit 78efe9bebb
4 changed files with 27 additions and 19 deletions

View File

@@ -19,7 +19,8 @@ from django.urls import reverse_lazy, reverse
from lostplaces.models import (
Place,
PlaceImage,
PlaceVoting
PlaceVoting,
PLACE_LEVELS
)
from lostplaces.views.base_views import (
@@ -71,7 +72,10 @@ class PlaceDetailView(IsAuthenticatedMixin, IsEligibleToSeePlaceMixin, View):
'submit_url': reverse('place_tag_submit', kwargs={'tagged_id': place.id}),
'delete_url_name': 'place_tag_delete'
},
'placevoting': PlaceVoting.objects.filter(place=place, submitted_by=explorer).first()
'placevoting': {
'users_vote': PlaceVoting.objects.filter(place=place, submitted_by=explorer).first(),
'all_choices': reversed(PLACE_LEVELS)
}
}
return render(request, 'place/place_detail.html', context)