First working version
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
{% extends 'base.html' %}
|
||||
{% block content %}
|
||||
<div class="container-lg">
|
||||
<form action="{% url 'watchlist:delete' movie.id %}" method="post">
|
||||
{% csrf_token %}
|
||||
<input type="submit" value="Delete movie" class="btn btn-danger">
|
||||
</form>
|
||||
<form action="{% url 'watchlist:edit' movie.id %}" method="post">
|
||||
{% csrf_token %}
|
||||
<div>
|
||||
<label class="form-label" for="name">Movie name</label>
|
||||
<input class="form-control" id="name" name="name" value="{{movie.name}}">
|
||||
</div>
|
||||
<div>
|
||||
<label class="form-label" for="suggested_by" name="suggested_by">Suggested by</label>
|
||||
<select class="form-select" id="suggested_by" name="suggested_by">
|
||||
{% if request.user.is_staff %}
|
||||
{% for user in users %}
|
||||
<option value="{{ user.username }}" {% if user.username == movie.suggested_by.username %} selected {% endif %} >{{user.username}}</option>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<option value="{{ movie.suggested_by.username }} disabled">{{movie.suggested_by.username}}</option>
|
||||
{% endif %}
|
||||
</select>
|
||||
</div>
|
||||
<input type="submit" value="Submit" class="btn btn-primary">
|
||||
</form>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,20 @@
|
||||
{% extends 'base.html' %}
|
||||
{% block content %}
|
||||
<div class="container-lg">
|
||||
<h1>Watchlist</h1>
|
||||
<ul>
|
||||
{% for movie in object_list %}
|
||||
<li><a href="{% url 'watchlist:detail' movie.id %}">{{movie.name}}</a> — {{movie.score}}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% if can_add_movie %}
|
||||
<h2>Submit new movie</h2>
|
||||
<form action="{% url 'watchlist:submit' %}" method="post">
|
||||
{% csrf_token %}
|
||||
<label class="form-label" for="name">Movie name</label>
|
||||
<input class="form-control" type="text" id="name" name="name" required>
|
||||
<input class="btn btn-primary" type="submit" value="Sumbit">
|
||||
</form>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,39 @@
|
||||
{% 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 %} – {% 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 %}
|
||||
Reference in New Issue
Block a user