Compare commits
2 Commits
a24bfa4806
...
81599a9bde
| Author | SHA1 | Date | |
|---|---|---|---|
| 81599a9bde | |||
| 6f64fbb092 |
@ -123,3 +123,5 @@ STATIC_URL = 'static/'
|
||||
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field
|
||||
|
||||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||
|
||||
LOGIN_REDIRECT_URL = '/polls'
|
||||
|
||||
@ -23,4 +23,5 @@ urlpatterns = [
|
||||
path('polls/', include('polls.urls')),
|
||||
|
||||
path('admin/', admin.site.urls),
|
||||
path('', include('django.contrib.auth.urls')),
|
||||
]
|
||||
|
||||
96
polls/templates/base.html
Normal file
96
polls/templates/base.html
Normal file
@ -0,0 +1,96 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" data-bs-theme="dark">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
|
||||
<title>{% block title %}Test site{% endblock %}</title>
|
||||
<style>
|
||||
.darker-bg {
|
||||
background-color: #171a1e;
|
||||
}
|
||||
body {
|
||||
min-height: 75rem;
|
||||
padding-top: 3rem;
|
||||
}
|
||||
.list-group {
|
||||
width: 100%;
|
||||
max-width: 460px;
|
||||
margin-inline: 1.5rem;
|
||||
}
|
||||
.list-group-checkable .list-group-item {
|
||||
cursor: pointer;
|
||||
}
|
||||
.list-group-item-check {
|
||||
position: absolute;
|
||||
clip: rect(0, 0, 0, 0);
|
||||
}
|
||||
.list-group-item-check:hover + .list-group-item {
|
||||
background-color: var(--bs-secondary-bg);
|
||||
}
|
||||
.list-group-item-check:checked + .list-group-item {
|
||||
color: #fff;
|
||||
background-color: var(--bs-primary);
|
||||
border-color: var(--bs-primary);
|
||||
}
|
||||
.list-group-item-check[disabled] + .list-group-item,
|
||||
.list-group-item-check:disabled + .list-group-item {
|
||||
pointer-events: none;
|
||||
filter: none;
|
||||
opacity: .5;
|
||||
}
|
||||
.list-group-radio .list-group-item {
|
||||
cursor: pointer;
|
||||
border-radius: .5rem;
|
||||
}
|
||||
.list-group-radio .form-check-input {
|
||||
z-index: 2;
|
||||
margin-top: -.5em;
|
||||
}
|
||||
.list-group-radio .list-group-item:hover,
|
||||
.list-group-radio .list-group-item:focus {
|
||||
background-color: var(--bs-secondary-bg);
|
||||
}
|
||||
|
||||
.list-group-radio .form-check-input:checked + .list-group-item {
|
||||
background-color: var(--bs-body);
|
||||
border-color: var(--bs-primary);
|
||||
box-shadow: 0 0 0 2px var(--bs-primary);
|
||||
}
|
||||
.list-group-radio .form-check-input[disabled] + .list-group-item,
|
||||
.list-group-radio .form-check-input:disabled + .list-group-item {
|
||||
pointer-events: none;
|
||||
filter: none;
|
||||
opacity: .5;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="/polls">Test App</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarCollapse">
|
||||
<ul class="navbar-nav me-auto mb-2 mb-md-0">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" aria-current="page" href="/polls">Polls</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="d-flex">
|
||||
{% if user.is_authenticated %}
|
||||
<a href="/logout"><button class="btn btn-outline-success">Log out</button></a>
|
||||
{% else %}
|
||||
<button class="btn btn-primary">Log In</button>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<main class="px-4 py-5 shadow darker-bg">
|
||||
{% block content %}{% endblock %}
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
@ -1,69 +1,9 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" data-bs-theme="dark">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
|
||||
<title>Testapp</title>
|
||||
<style>
|
||||
.darker-bg {
|
||||
background-color: #171a1e;
|
||||
}
|
||||
.list-group {
|
||||
width: 100%;
|
||||
max-width: 460px;
|
||||
margin-inline: 1.5rem;
|
||||
}
|
||||
.list-group-checkable .list-group-item {
|
||||
cursor: pointer;
|
||||
}
|
||||
.list-group-item-check {
|
||||
position: absolute;
|
||||
clip: rect(0, 0, 0, 0);
|
||||
}
|
||||
.list-group-item-check:hover + .list-group-item {
|
||||
background-color: var(--bs-secondary-bg);
|
||||
}
|
||||
.list-group-item-check:checked + .list-group-item {
|
||||
color: #fff;
|
||||
background-color: var(--bs-primary);
|
||||
border-color: var(--bs-primary);
|
||||
}
|
||||
.list-group-item-check[disabled] + .list-group-item,
|
||||
.list-group-item-check:disabled + .list-group-item {
|
||||
pointer-events: none;
|
||||
filter: none;
|
||||
opacity: .5;
|
||||
}
|
||||
.list-group-radio .list-group-item {
|
||||
cursor: pointer;
|
||||
border-radius: .5rem;
|
||||
}
|
||||
.list-group-radio .form-check-input {
|
||||
z-index: 2;
|
||||
margin-top: -.5em;
|
||||
}
|
||||
.list-group-radio .list-group-item:hover,
|
||||
.list-group-radio .list-group-item:focus {
|
||||
background-color: var(--bs-secondary-bg);
|
||||
}
|
||||
{% extends "base.html" %}
|
||||
|
||||
.list-group-radio .form-check-input:checked + .list-group-item {
|
||||
background-color: var(--bs-body);
|
||||
border-color: var(--bs-primary);
|
||||
box-shadow: 0 0 0 2px var(--bs-primary);
|
||||
}
|
||||
.list-group-radio .form-check-input[disabled] + .list-group-item,
|
||||
.list-group-radio .form-check-input:disabled + .list-group-item {
|
||||
pointer-events: none;
|
||||
filter: none;
|
||||
opacity: .5;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="px-4 py-5 my-5 text-center shadow darker-bg">
|
||||
{% block title %}{{ question.question_text }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="text-center">
|
||||
<h1 class="display-5 fw-bold text-body-emphasis">{{ question.question_text }}</h1>
|
||||
<br/>
|
||||
|
||||
@ -82,5 +22,4 @@
|
||||
<input class="btn btn-success rounded-3 px-3" type="submit" value="Vote">
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
{% endblock %}
|
||||
|
||||
@ -1,20 +1,8 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" data-bs-theme="dark">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
|
||||
<title>Testapp</title>
|
||||
<style>
|
||||
.darker-bg {
|
||||
background-color: #171a1e;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="px-4 py-5 my-5 shadow darker-bg">
|
||||
{% block title %}Polls{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1 class="display-5 fw-bold text-body-emphasis text-center">Polls</h1>
|
||||
<br/>
|
||||
<div class="d-flex flex-column flex-md-row col-lg-6 mx-auto align-items-center justify-content-center">
|
||||
@ -40,6 +28,4 @@
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
{% endblock %}
|
||||
|
||||
@ -1,69 +1,8 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" data-bs-theme="dark">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
|
||||
<title>Testapp</title>
|
||||
<style>
|
||||
.darker-bg {
|
||||
background-color: #171a1e;
|
||||
}
|
||||
.list-group {
|
||||
width: 100%;
|
||||
max-width: 460px;
|
||||
margin-inline: 1.5rem;
|
||||
}
|
||||
.list-group-checkable .list-group-item {
|
||||
cursor: pointer;
|
||||
}
|
||||
.list-group-item-check {
|
||||
position: absolute;
|
||||
clip: rect(0, 0, 0, 0);
|
||||
}
|
||||
.list-group-item-check:hover + .list-group-item {
|
||||
background-color: var(--bs-secondary-bg);
|
||||
}
|
||||
.list-group-item-check:checked + .list-group-item {
|
||||
color: #fff;
|
||||
background-color: var(--bs-primary);
|
||||
border-color: var(--bs-primary);
|
||||
}
|
||||
.list-group-item-check[disabled] + .list-group-item,
|
||||
.list-group-item-check:disabled + .list-group-item {
|
||||
pointer-events: none;
|
||||
filter: none;
|
||||
opacity: .5;
|
||||
}
|
||||
.list-group-radio .list-group-item {
|
||||
cursor: pointer;
|
||||
border-radius: .5rem;
|
||||
}
|
||||
.list-group-radio .form-check-input {
|
||||
z-index: 2;
|
||||
margin-top: -.5em;
|
||||
}
|
||||
.list-group-radio .list-group-item:hover,
|
||||
.list-group-radio .list-group-item:focus {
|
||||
background-color: var(--bs-secondary-bg);
|
||||
}
|
||||
{% extends "base.html" %}
|
||||
|
||||
.list-group-radio .form-check-input:checked + .list-group-item {
|
||||
background-color: var(--bs-body);
|
||||
border-color: var(--bs-primary);
|
||||
box-shadow: 0 0 0 2px var(--bs-primary);
|
||||
}
|
||||
.list-group-radio .form-check-input[disabled] + .list-group-item,
|
||||
.list-group-radio .form-check-input:disabled + .list-group-item {
|
||||
pointer-events: none;
|
||||
filter: none;
|
||||
opacity: .5;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="px-4 py-5 my-5 shadow darker-bg">
|
||||
{% block title %}{{ question.question_text }} Results{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1 class="display-5 fw-bold text-body-emphasis text-center">{{ question.question_text }}</h1>
|
||||
<br/>
|
||||
<h1 class="text-center">Results</h1>
|
||||
@ -80,13 +19,10 @@
|
||||
</div>
|
||||
-->
|
||||
</div>
|
||||
|
||||
<small class="text-nowrap">{{ choice_votes }} vote{{ choice_votes|pluralize }}</small>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div{{ question.question_text }}>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
{% endblock %}
|
||||
|
||||
40
polls/templates/registration/login.html
Normal file
40
polls/templates/registration/login.html
Normal file
@ -0,0 +1,40 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Login{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{% if form.errors %}
|
||||
<p>Your username and password didn't match. Please try again.</p>
|
||||
{% endif %}
|
||||
|
||||
{% if next %}
|
||||
{% if user.is_authenticated %}
|
||||
<p>Your account doesn't have access to this page. To proceed,
|
||||
please login with an account that has access.</p>
|
||||
{% else %}
|
||||
<p>Please login to see this page.</p>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
<form method="post" action="{% url 'login' %}">
|
||||
{% csrf_token %}
|
||||
<table>
|
||||
<tr>
|
||||
<td>{{ form.username.label_tag }}</td>
|
||||
<td>{{ form.username }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ form.password.label_tag }}</td>
|
||||
<td>{{ form.password }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<input type="submit" value="login">
|
||||
<input type="hidden" name="next" value="{{ next }}">
|
||||
</form>
|
||||
|
||||
{# Assumes you set up the password_reset view in your URLconf #}
|
||||
<p><a href="{% url 'password_reset' %}">Lost password?</a></p>
|
||||
|
||||
{% endblock %}
|
||||
Loading…
x
Reference in New Issue
Block a user