movieclub/templates/watchlist/movie_detail.html

39 lines
2.3 KiB
HTML

{% extends 'base.html' %}
{% block content %}
<div class="container-lg">
<h1 class="display-1">{{ movie.name }}</h1>
<p class="text-secondary">Suggested by: {{movie.suggested_by.username}}</p>
{% if request.user.is_staff or movie.suggested_by == request.user %}<div class="mb-2"><a class="btn btn-sm btn-danger" href="{% url 'watchlist:edit' movie.id %}">Edit</a></div>{% endif %}
<h2>Votes</h2>
{% if votes|length == 0 %}
<p>Nobody voted yet, be first...</p>
{% else %}
<p>Total score: {{ movie.score }}, seen by: {{ movie.seen_score }}.
<ul>
{% for vote in votes %}
<li>{{vote.user.username}} {% if vote.seen %}(seen){% endif %} &ndash; {% if vote.vote == 1 %}👍{% elif vote.vote == 0 %}No opinion{% elif vote.vote == -1 %}👎{%endif%}</li>
{% endfor %}
</ul>
{% endif %}
{% if request.user.is_authenticated %}
<h2>Your opinion</h2>
<form action="{% url 'watchlist:vote' movie.id %}" method="post">
{% csrf_token %}
<div class="form-check">
<input class="form-check-input" type="radio" name="vote" id="vote-upvote" value="1" {% if user_vote and user_vote.vote == 1 %} checked {% endif %}><label class="form-check-label" for="vote-upvote">Want to watch</label><br>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="vote" id="vote-novote" value="0" {% if user_vote is None or user_vote.vote == 0 %} checked {% endif %}><label class="form-check-label" for="vote-novote">No opinion</label><br>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="vote" id="vote-downvote" value="-1" {% if user_vote and user_vote.vote == -1 %} checked {% endif %}><label class="form-check-label" for="vote-downvote">Don't want to watch</label><br>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="seen" name="seen" {% if user_vote and user_vote.seen %} checked {%endif%}><label class="form-check-label" for="seen">I saw this movie already</label><br>
</div>
<input class="btn btn-primary" type="submit" value="Submit">
</form>
</h2>
{% endif %}
</div>
{% endblock %}