First working version
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
<h1>You can't access this resource.</h1>
|
||||
<p>{{exception}}</p>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,4 @@
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
<h1>Nothing here...</h1>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,6 @@
|
||||
{% for field in form %}
|
||||
<div class="fieldWrapper">
|
||||
{{ field.errors }}
|
||||
{{ field.label_tag }} {{ field }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
@@ -0,0 +1 @@
|
||||
{% if use_tag %}<{{ tag }}{% include 'django/forms/attrs.html' %}>{{ label }}</{{ tag }}>{% else %}{{ label }}{% endif %}
|
||||
@@ -0,0 +1,18 @@
|
||||
{% extends 'base.html' %}
|
||||
{% block content %}
|
||||
<div class="container container-sm">
|
||||
<form action="{% url 'auth:login' %}" method="post">
|
||||
{% csrf_token %}
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="username">Username:</label>
|
||||
<input class="form-control" type="text" name="username" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="password">Password:</label>
|
||||
<input class="form-control" type="password" name="password" required>
|
||||
</div>
|
||||
<input type="submit" class="btn btn-primary" value="Submit">
|
||||
</form>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,49 @@
|
||||
{% load static %}
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset='utf-8'>
|
||||
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
|
||||
<title>{% block title %}Movieclub{% endblock %}</title>
|
||||
<meta name='viewport' content='width=device-width, initial-scale=1'>
|
||||
<link rel='stylesheet' type='text/css' media='screen' href='{% static "style/main.css" %}'>
|
||||
<!-- Bootstrap -->
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
|
||||
</head>
|
||||
<body>
|
||||
{% block body %}
|
||||
{% block menu %}
|
||||
<nav class="navbar navbar-expand-lg bg-light">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="/">Movieclub</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar-content">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbar-content">
|
||||
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{% url 'watchlist:index' %}">Watchlist</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" style="text-decoration: line-through" href="#">Reviews</a>
|
||||
</li>
|
||||
<li class="nav-item end-0">
|
||||
{% if request.user.is_authenticated %}
|
||||
<a class="nav-link" href="{% url 'auth:logout' %}">Logout</a>
|
||||
{% else %}
|
||||
<a class="nav-link" href="{% url 'auth:login' %}">Login</a>
|
||||
{% endif %}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
<p>Welcome to out little movieclub.</p>
|
||||
{% endblock %}
|
||||
<!-- Bootstrap -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4" crossorigin="anonymous"></script>
|
||||
{% endblock %}
|
||||
</body>
|
||||
</html>
|
||||
@@ -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