сделал фавикон и красивую страничку регистрации
@ -8,9 +8,9 @@ urlpatterns = [
|
|||||||
path('', include('home.urls')),
|
path('', include('home.urls')),
|
||||||
path('admin/', admin.site.urls),
|
path('admin/', admin.site.urls),
|
||||||
path('films/', include('films.urls'), name='films'),
|
path('films/', include('films.urls'), name='films'),
|
||||||
|
path('timetable/', include('timetable.urls'), name='timetable'),
|
||||||
path("auth/", include("users.urls"), name="auth"),
|
path("auth/", include("users.urls"), name="auth"),
|
||||||
path("auth/", include("django.contrib.auth.urls"), name="auth"),
|
path("auth/", include("django.contrib.auth.urls"), name="auth"),
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
|
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
|
||||||
|
|||||||
6
CineSync/static/css/base.css
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
.btn, .nav-link {
|
||||||
|
border-radius: 1vw !important;
|
||||||
|
}
|
||||||
|
body {
|
||||||
|
background-color: #0d1d3a;
|
||||||
|
}
|
||||||
27
CineSync/static/css/header.css
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
.header_icon {
|
||||||
|
width: 5vw;
|
||||||
|
border-radius: 1.5vw;
|
||||||
|
padding:1vw;
|
||||||
|
}
|
||||||
|
.header_row, .auth_row, header {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
flex-wrap: nowrap;
|
||||||
|
}
|
||||||
|
header {
|
||||||
|
justify-content: space-between;
|
||||||
|
background-color: #ffffff;
|
||||||
|
position: fixed;
|
||||||
|
margin: 1%;
|
||||||
|
width: 98%;
|
||||||
|
border-radius: 0.8vw;;
|
||||||
|
}
|
||||||
|
.header_container {
|
||||||
|
width: 100%;
|
||||||
|
z-index: 103;
|
||||||
|
}
|
||||||
|
.nav-item {
|
||||||
|
margin: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
@ -11,16 +11,21 @@
|
|||||||
}
|
}
|
||||||
header {
|
header {
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
background-color: #ffffff;
|
background-color: #eaeaea;
|
||||||
position: fixed;
|
|
||||||
margin: 1%;
|
margin: 1%;
|
||||||
width: 98%;
|
width: 98%;
|
||||||
border-radius: 0.8vw;;
|
border-radius: 0.8vw;;
|
||||||
}
|
}
|
||||||
.header_container {
|
.header_container {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
position: fixed;
|
||||||
}
|
}
|
||||||
.nav-item {
|
.nav-item {
|
||||||
margin: 5px;
|
margin: 5px;
|
||||||
}
|
}
|
||||||
|
.header_hole {
|
||||||
|
height: 5vw;
|
||||||
|
}
|
||||||
|
.auth_row {
|
||||||
|
margin-right: 1vw;
|
||||||
|
}
|
||||||
|
|||||||
16
CineSync/static/css/users/login.css
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
.login_block, form {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
flex-wrap: nowrap;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.login_block {
|
||||||
|
margin-left: 30%;
|
||||||
|
margin-right: 30%;
|
||||||
|
margin-top: 10vw;
|
||||||
|
border-radius: 3vw;
|
||||||
|
background-color: #eaeaea;
|
||||||
|
padding-top: 2vw;
|
||||||
|
padding-bottom: 2vw;
|
||||||
|
width: 40%;
|
||||||
|
}
|
||||||
19
CineSync/static/css/users/signup.css
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
.signup_block, form {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
flex-wrap: nowrap;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.signup_block {
|
||||||
|
margin-left: 30%;
|
||||||
|
margin-right: 30%;
|
||||||
|
margin-top: 3.5vw;
|
||||||
|
border-radius: 3vw;
|
||||||
|
background-color: #eaeaea;
|
||||||
|
padding-top: 2vw;
|
||||||
|
padding-bottom: 2vw;
|
||||||
|
width: 40%;
|
||||||
|
}
|
||||||
|
.form_item {
|
||||||
|
width: 30vw !important;
|
||||||
|
}
|
||||||
BIN
CineSync/static/img/android-chrome-192x192.png
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
CineSync/static/img/android-chrome-512x512.png
Normal file
|
After Width: | Height: | Size: 268 KiB |
BIN
CineSync/static/img/apple-touch-icon.png
Normal file
|
After Width: | Height: | Size: 43 KiB |
9
CineSync/static/img/browserconfig.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<browserconfig>
|
||||||
|
<msapplication>
|
||||||
|
<tile>
|
||||||
|
<square150x150logo src="/mstile-150x150.png"/>
|
||||||
|
<TileColor>#da532c</TileColor>
|
||||||
|
</tile>
|
||||||
|
</msapplication>
|
||||||
|
</browserconfig>
|
||||||
BIN
CineSync/static/img/favicon-16x16.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
CineSync/static/img/favicon-32x32.png
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
BIN
CineSync/static/img/favicon.ico
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
CineSync/static/img/mstile-150x150.png
Normal file
|
After Width: | Height: | Size: 24 KiB |
19
CineSync/static/img/site.webmanifest
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"name": "",
|
||||||
|
"short_name": "",
|
||||||
|
"icons": [
|
||||||
|
{
|
||||||
|
"src": "/android-chrome-192x192.png",
|
||||||
|
"sizes": "192x192",
|
||||||
|
"type": "image/png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "/android-chrome-512x512.png",
|
||||||
|
"sizes": "512x512",
|
||||||
|
"type": "image/png"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"theme_color": "#ffffff",
|
||||||
|
"background_color": "#ffffff",
|
||||||
|
"display": "standalone"
|
||||||
|
}
|
||||||
@ -8,7 +8,7 @@
|
|||||||
<title>{% block title %}{% endblock title %}</title>
|
<title>{% block title %}{% endblock title %}</title>
|
||||||
<link href="{% static 'css/bootstrap/bootstrap.min.css' %}" rel="stylesheet">
|
<link href="{% static 'css/bootstrap/bootstrap.min.css' %}" rel="stylesheet">
|
||||||
<link rel="stylesheet" href="{% static 'css/header.css' %}"/>
|
<link rel="stylesheet" href="{% static 'css/header.css' %}"/>
|
||||||
<link rel="stylesheet" href="{% static 'css/footer.css' %}"/>
|
<!--<link rel="stylesheet" href="{% static 'css/footer.css' %}"/>-->
|
||||||
<link rel="apple-touch-icon" sizes="180x180" href="{% static 'img/apple-touch-icon.png' %}">
|
<link rel="apple-touch-icon" sizes="180x180" href="{% static 'img/apple-touch-icon.png' %}">
|
||||||
<link rel="icon" type="image/png" sizes="32x32" href="{% static 'img/favicon-32x32.png' %}">
|
<link rel="icon" type="image/png" sizes="32x32" href="{% static 'img/favicon-32x32.png' %}">
|
||||||
<link rel="icon" type="image/png" sizes="16x16" href="{% static 'img/favicon-16x16.png' %}">
|
<link rel="icon" type="image/png" sizes="16x16" href="{% static 'img/favicon-16x16.png' %}">
|
||||||
@ -16,6 +16,7 @@
|
|||||||
<link rel="icon" type="image/x-icon" href="{% static 'img/favicon.ico' %}">
|
<link rel="icon" type="image/x-icon" href="{% static 'img/favicon.ico' %}">
|
||||||
<link href="{% static 'css/bootstrap.min.css' %}" rel="stylesheet">
|
<link href="{% static 'css/bootstrap.min.css' %}" rel="stylesheet">
|
||||||
<link rel="stylesheet" href="{% static 'css/includes/header.css' %}"/>
|
<link rel="stylesheet" href="{% static 'css/includes/header.css' %}"/>
|
||||||
|
<link rel="stylesheet" href="{% static 'css/base.css' %}"/>
|
||||||
<meta name="msapplication-TileColor" content="#da532c">
|
<meta name="msapplication-TileColor" content="#da532c">
|
||||||
<meta name="theme-color" content="#ffffff">
|
<meta name="theme-color" content="#ffffff">
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
@ -1,17 +1,18 @@
|
|||||||
{% if echo %}
|
{% if echo %}
|
||||||
<form method="post" action="{% url 'homepage:echo_submit' %}">
|
<form method="post" action="{% url 'homepage:echo_submit' %}">
|
||||||
{% else %}
|
{% else %}
|
||||||
<form method="post">
|
<form method="post">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{% for field in form.visible_fields %}
|
{% for field in form.visible_fields %}
|
||||||
<div class="mb-3 {% if field.widget_type == 'checkbox' %}form-check{% endif %}">
|
<div class="mb-3 form_item {% if field.widget_type == 'checkbox' %}form-check{% endif %}">
|
||||||
<label for="{{ field.id_for_label }}" class="form-label">{{ field.label }}</label>
|
<label for="{{ field.id_for_label }}" class="form-label">{{ field.label }}</label>
|
||||||
{{ field }}
|
{{ field }}
|
||||||
{% if field.help_text %}
|
{% if field.help_text %}
|
||||||
<div class="form-text">{{ field.help_text }}</div>
|
<div class="form-text">{{ field.help_text }}</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<button type="submit" class="btn btn-primary" style="margin-top: 50px">Отправить</button>
|
<button type="submit" class="btn btn-primary">{% if text_button %} {{ text_button }} {% else %} отправить {% endif %}
|
||||||
</form>
|
</button>
|
||||||
|
</form>
|
||||||
|
|||||||
@ -10,12 +10,12 @@
|
|||||||
href="{% url 'home:homepage' %}">Главная</a>
|
href="{% url 'home:homepage' %}">Главная</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link {% if view_name == 'home:homepage' %} active {% endif %}"
|
<a class="nav-link {% if view_name == 'films:main' %} active {% endif %}"
|
||||||
href="{% url 'home:homepage' %}">Фильмы</a>
|
href="{% url 'films:main' %}">Фильмы</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link {% if view_name == 'home:homepage' %} active {% endif %}"
|
<a class="nav-link {% if view_name == 'time_table:main' %} active {% endif %}"
|
||||||
href="{% url 'home:homepage' %}">Расписание</a>
|
href="{% url 'time_table:main' %}">Расписание</a>
|
||||||
</li>
|
</li>
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
</ul>
|
</ul>
|
||||||
@ -26,13 +26,14 @@
|
|||||||
{% else %}
|
{% else %}
|
||||||
<ul class="nav nav-pills">
|
<ul class="nav nav-pills">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="btn btn-primary" href="{% url 'home:homepage' %}">Регистрация</a>
|
<a class="btn btn-primary" href="{% url 'users:signup' %}">Регистрация</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="btn btn-secondary" href="{% url 'home:homepage' %}">Вход</a>
|
<a class="btn btn-secondary" href="{% url 'users:login' %}">Вход</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="header_hole"></div>
|
||||||
@ -1,32 +1,38 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% load static %}
|
{% load static %}
|
||||||
{% load i18n %}
|
|
||||||
{% block title %}
|
{% block title %}
|
||||||
{% trans "Вход" %}
|
Вход
|
||||||
{% endblock title %}
|
{% endblock title %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h1>Вход в аккаунт</h1>
|
<link href="{% static 'css/users/login.css' %}" rel="stylesheet">
|
||||||
{% include "includes/form.html" with form=form %}
|
<div class="login_block">
|
||||||
{% comment %}
|
<h1>Вход в аккаунт</h1>
|
||||||
|
{% include "includes/form.html" with form=form %}
|
||||||
|
{% comment %}
|
||||||
{% if echo %}
|
{% if echo %}
|
||||||
<form method="post" action="{% url 'homepage:echo_submit' %}">
|
<form method="post" action="{% url 'homepage:echo_submit' %}">
|
||||||
{% else %}
|
{% else %}
|
||||||
<form method="post">
|
<form method="post">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{% for field in form.visible_fields %}
|
{% for field in form.visible_fields %}
|
||||||
<div class="mb-3 {% if field.widget_type == 'checkbox' %}form-check{% endif %}">
|
<div class="mb-3 {% if field.widget_type == 'checkbox' %}form-check{% endif %}">
|
||||||
<label for="{{ field.id_for_label }}" class="form-label">{{ field.label }}</label>
|
<label for="{{ field.id_for_label }}" class="form-label">{{ field.label }}</label>
|
||||||
{{ field }}
|
{{ field }}
|
||||||
{% if field.help_text %}
|
{% if field.help_text %}
|
||||||
<div class="form-text">{{ field.help_text }}</div>
|
<div class="form-text">{{ field.help_text }}</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<button type="submit" class="btn btn-primary" style="margin-top: 50px">Отправить</button>
|
<button type="submit" class="btn btn-primary">Отправить</button>
|
||||||
</form>
|
</form>
|
||||||
{% endcomment %}
|
{% endcomment %}
|
||||||
<br>
|
<br>
|
||||||
<a href="{% url 'users:password_reset' %}" class="link-primary link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover">Восстановить пароль</a>
|
<a href="{% url 'users:password_reset' %}"
|
||||||
<a href="{% url 'users:signup' %}" class="link-primary link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover">Создать аккаунт</a>
|
class="link-primary link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover">Восстановить
|
||||||
{% endblock %}
|
пароль</a>
|
||||||
|
<a href="{% url 'users:signup' %}"
|
||||||
|
class="link-primary link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover">Создать
|
||||||
|
аккаунт</a>
|
||||||
|
{% endblock %}
|
||||||
|
</div>
|
||||||
@ -1,5 +1,10 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
|
{% load static %}
|
||||||
{% block title %}Регистрация{% endblock %}
|
{% block title %}Регистрация{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% include "includes/form.html" %}
|
<link href="{% static 'css/users/signup.css' %}" rel="stylesheet">
|
||||||
|
<div class="signup_block">
|
||||||
|
<h1>Регистрация</h1>
|
||||||
|
{% include "includes/form.html" %}
|
||||||
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
9
CineSync/timetable/urls.py
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
from django.urls import path
|
||||||
|
|
||||||
|
from films.views import films_list, film_details
|
||||||
|
|
||||||
|
app_name = 'time_table'
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
path('', films_list, name='main'),
|
||||||
|
]
|
||||||
@ -9,15 +9,15 @@ from django.views.generic import View
|
|||||||
from users.forms import SignUpForm, ProfileForm, UserForm
|
from users.forms import SignUpForm, ProfileForm, UserForm
|
||||||
from users.models import Profile
|
from users.models import Profile
|
||||||
|
|
||||||
|
|
||||||
__all__ = []
|
__all__ = []
|
||||||
|
|
||||||
|
|
||||||
def signup(request):
|
def signup(request):
|
||||||
form = SignUpForm(request.POST)
|
form = SignUpForm(request.POST)
|
||||||
template = "users/signup.html"
|
template = 'users/signup.html'
|
||||||
context = {
|
context = {
|
||||||
"form": form,
|
'form': form,
|
||||||
|
'text_button': 'Зарегистрироваться',
|
||||||
}
|
}
|
||||||
if request.method == 'GET':
|
if request.method == 'GET':
|
||||||
return render(request, template, context)
|
return render(request, template, context)
|
||||||
@ -27,8 +27,8 @@ def signup(request):
|
|||||||
user.save()
|
user.save()
|
||||||
Profile.objects.create(user=user)
|
Profile.objects.create(user=user)
|
||||||
user.profile.save()
|
user.profile.save()
|
||||||
messages.success(request, _("Пользователь упешно создан"))
|
messages.success(request, _('Пользователь упешно создан'))
|
||||||
return redirect(reverse("users:login"))
|
return redirect(reverse('users:login'))
|
||||||
|
|
||||||
return render(request, template, context)
|
return render(request, template, context)
|
||||||
|
|
||||||
@ -45,11 +45,12 @@ def profile(request):
|
|||||||
if request.method == 'GET':
|
if request.method == 'GET':
|
||||||
return render(
|
return render(
|
||||||
request,
|
request,
|
||||||
"users/profile.html",
|
'users/profile.html',
|
||||||
{
|
{
|
||||||
"profile_form": profile_form,
|
'profile_form': profile_form,
|
||||||
"user_form": user_form,
|
'user_form': user_form,
|
||||||
"user": request.user,
|
'user': request.user,
|
||||||
|
'text_button': 'Войти',
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -59,37 +60,10 @@ def profile(request):
|
|||||||
|
|
||||||
return render(
|
return render(
|
||||||
request,
|
request,
|
||||||
"users/profile.html",
|
'users/profile.html',
|
||||||
{
|
{
|
||||||
"profile_form": profile_form,
|
'profile_form': profile_form,
|
||||||
"user_form": user_form,
|
'user_form': user_form,
|
||||||
"user": request.user,
|
'user': request.user,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class SignupView(View):
|
|
||||||
def get(self, request):
|
|
||||||
form = SignUpForm()
|
|
||||||
template = "users/signup.html"
|
|
||||||
context = {
|
|
||||||
"form": form,
|
|
||||||
}
|
|
||||||
return render(request, template, context)
|
|
||||||
|
|
||||||
def post(self, request):
|
|
||||||
form = SignUpForm(request.POST)
|
|
||||||
if form.is_valid():
|
|
||||||
user = form.save(commit=False)
|
|
||||||
user.is_active = settings.DEFAULT_USER_IS_ACTIVE
|
|
||||||
user.save()
|
|
||||||
Profile.objects.create(user=user)
|
|
||||||
user.profile.save()
|
|
||||||
messages.success(request, _("Пользователь упешно создан"))
|
|
||||||
return redirect(reverse("users:login"))
|
|
||||||
|
|
||||||
template = "users/signup.html"
|
|
||||||
context = {
|
|
||||||
"form": form,
|
|
||||||
}
|
|
||||||
return render(request, template, context)
|
|
||||||
|
|||||||