fix vote button
This commit is contained in:
parent
afe24cbcf8
commit
c053ef10c0
|
@ -85,11 +85,11 @@
|
|||
{% if talk.accepted == None %}
|
||||
<h3>{% trans "Vote" %}</h3>
|
||||
<div class="btn-group" role="group" aria-label="vote">
|
||||
<a class="btn {% if vote.vote == -2 %} active {% endif %}btn-danger" href="{% url 'talk-vote' talk.token '-2' %}">-2</a>
|
||||
<a class="btn {% if vote.vote == -1 %} active {% endif %}btn-warning" href="{% url 'talk-vote' talk.token '-1' %}">-1</a>
|
||||
<a class="btn {% if vote.vote == 0 %} active {% endif %}btn-default" href="{% url 'talk-vote' talk.token '0' %}"> 0</a>
|
||||
<a class="btn {% if vote.vote == 1 %} active {% endif %}btn-info" href="{% url 'talk-vote' talk.token '+1' %}">+1</a>
|
||||
<a class="btn {% if vote.vote == 2 %} active {% endif %}btn-success" href="{% url 'talk-vote' talk.token '+2' %}">+2</a>
|
||||
<a class="btn {% if vote == -2 %} active {% endif %}btn-danger" href="{% url 'talk-vote' talk.token '-2' %}">-2</a>
|
||||
<a class="btn {% if vote == -1 %} active {% endif %}btn-warning" href="{% url 'talk-vote' talk.token '-1' %}">-1</a>
|
||||
<a class="btn {% if vote == 0 %} active {% endif %}btn-default" href="{% url 'talk-vote' talk.token '0' %}"> 0</a>
|
||||
<a class="btn {% if vote == 1 %} active {% endif %}btn-info" href="{% url 'talk-vote' talk.token '+1' %}">+1</a>
|
||||
<a class="btn {% if vote == 2 %} active {% endif %}btn-success" href="{% url 'talk-vote' talk.token '+2' %}">+2</a>
|
||||
</div>
|
||||
<br /><br />
|
||||
<p>{{ talk.vote_set.count }} {% trans "vote" %}{{ talk.vote_set.count|pluralize }}, {% trans "average:" %} {{ talk.score|floatformat:1 }}</p>
|
||||
|
|
|
@ -347,6 +347,10 @@ def talk_list(request):
|
|||
@staff_required
|
||||
def talk_details(request, talk_id):
|
||||
talk = get_object_or_404(Talk, token=talk_id, site=request.conference.site)
|
||||
try:
|
||||
vote = talk.vote_set.get(user=request.user).vote
|
||||
except Vote.DoesNotExist:
|
||||
vote = None
|
||||
message_form = MessageForm(request.POST or None)
|
||||
if request.method == 'POST' and message_form.is_valid():
|
||||
message = message_form.save(commit=False)
|
||||
|
@ -358,6 +362,7 @@ def talk_details(request, talk_id):
|
|||
return redirect(reverse('talk-details', args=[talk.token]))
|
||||
return render(request, 'cfp/staff/talk_details.html', {
|
||||
'talk': talk,
|
||||
'vote': vote,
|
||||
})
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue