сделал фавикон и красивую страничку регистрации
@ -8,9 +8,9 @@ urlpatterns = [
|
||||
path('', include('home.urls')),
|
||||
path('admin/', admin.site.urls),
|
||||
path('films/', include('films.urls'), name='films'),
|
||||
path('timetable/', include('timetable.urls'), name='timetable'),
|
||||
path("auth/", include("users.urls"), name="auth"),
|
||||
path("auth/", include("django.contrib.auth.urls"), name="auth"),
|
||||
|
||||
]
|
||||
|
||||
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 {
|
||||
justify-content: space-between;
|
||||
background-color: #ffffff;
|
||||
position: fixed;
|
||||
background-color: #eaeaea;
|
||||
margin: 1%;
|
||||
width: 98%;
|
||||
border-radius: 0.8vw;;
|
||||
}
|
||||
.header_container {
|
||||
width: 100%;
|
||||
position: fixed;
|
||||
}
|
||||
.nav-item {
|
||||
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>
|
||||
<link href="{% static 'css/bootstrap/bootstrap.min.css' %}" rel="stylesheet">
|
||||
<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="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' %}">
|
||||
@ -16,6 +16,7 @@
|
||||
<link rel="icon" type="image/x-icon" href="{% static 'img/favicon.ico' %}">
|
||||
<link href="{% static 'css/bootstrap.min.css' %}" rel="stylesheet">
|
||||
<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="theme-color" content="#ffffff">
|
||||
</head>
|
||||
|
||||
@ -1,17 +1,18 @@
|
||||
{% if echo %}
|
||||
<form method="post" action="{% url 'homepage:echo_submit' %}">
|
||||
{% else %}
|
||||
<form method="post">
|
||||
{% endif %}
|
||||
{% csrf_token %}
|
||||
{% for field in form.visible_fields %}
|
||||
<div class="mb-3 {% if field.widget_type == 'checkbox' %}form-check{% endif %}">
|
||||
<label for="{{ field.id_for_label }}" class="form-label">{{ field.label }}</label>
|
||||
{{ field }}
|
||||
{% if field.help_text %}
|
||||
<div class="form-text">{{ field.help_text }}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
<button type="submit" class="btn btn-primary" style="margin-top: 50px">Отправить</button>
|
||||
</form>
|
||||
<form method="post" action="{% url 'homepage:echo_submit' %}">
|
||||
{% else %}
|
||||
<form method="post">
|
||||
{% endif %}
|
||||
{% csrf_token %}
|
||||
{% for field in form.visible_fields %}
|
||||
<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>
|
||||
{{ field }}
|
||||
{% if field.help_text %}
|
||||
<div class="form-text">{{ field.help_text }}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
<button type="submit" class="btn btn-primary">{% if text_button %} {{ text_button }} {% else %} отправить {% endif %}
|
||||
</button>
|
||||
</form>
|
||||
|
||||
@ -10,12 +10,12 @@
|
||||
href="{% url 'home:homepage' %}">Главная</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {% if view_name == 'home:homepage' %} active {% endif %}"
|
||||
href="{% url 'home:homepage' %}">Фильмы</a>
|
||||
<a class="nav-link {% if view_name == 'films:main' %} active {% endif %}"
|
||||
href="{% url 'films:main' %}">Фильмы</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {% if view_name == 'home:homepage' %} active {% endif %}"
|
||||
href="{% url 'home:homepage' %}">Расписание</a>
|
||||
<a class="nav-link {% if view_name == 'time_table:main' %} active {% endif %}"
|
||||
href="{% url 'time_table:main' %}">Расписание</a>
|
||||
</li>
|
||||
{% endwith %}
|
||||
</ul>
|
||||
@ -26,13 +26,14 @@
|
||||
{% else %}
|
||||
<ul class="nav nav-pills">
|
||||
<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 class="nav-item">
|
||||
<a class="btn btn-secondary" href="{% url 'home:homepage' %}">Вход</a>
|
||||
<a class="btn btn-secondary" href="{% url 'users:login' %}">Вход</a>
|
||||
</li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
</div>
|
||||
</header>
|
||||
</div>
|
||||
</div>
|
||||
<div class="header_hole"></div>
|
||||
@ -1,32 +1,38 @@
|
||||
{% extends "base.html" %}
|
||||
{% load static %}
|
||||
{% load i18n %}
|
||||
{% block title %}
|
||||
{% trans "Вход" %}
|
||||
Вход
|
||||
{% endblock title %}
|
||||
{% block content %}
|
||||
<h1>Вход в аккаунт</h1>
|
||||
{% include "includes/form.html" with form=form %}
|
||||
{% comment %}
|
||||
<link href="{% static 'css/users/login.css' %}" rel="stylesheet">
|
||||
<div class="login_block">
|
||||
<h1>Вход в аккаунт</h1>
|
||||
{% include "includes/form.html" with form=form %}
|
||||
{% comment %}
|
||||
{% if echo %}
|
||||
<form method="post" action="{% url 'homepage:echo_submit' %}">
|
||||
{% else %}
|
||||
<form method="post">
|
||||
{% endif %}
|
||||
{% csrf_token %}
|
||||
{% for field in form.visible_fields %}
|
||||
<div class="mb-3 {% if field.widget_type == 'checkbox' %}form-check{% endif %}">
|
||||
<label for="{{ field.id_for_label }}" class="form-label">{{ field.label }}</label>
|
||||
{{ field }}
|
||||
{% if field.help_text %}
|
||||
<div class="form-text">{{ field.help_text }}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
<button type="submit" class="btn btn-primary" style="margin-top: 50px">Отправить</button>
|
||||
</form>
|
||||
{% endcomment %}
|
||||
<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:signup' %}" class="link-primary link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover">Создать аккаунт</a>
|
||||
{% endblock %}
|
||||
<form method="post" action="{% url 'homepage:echo_submit' %}">
|
||||
{% else %}
|
||||
<form method="post">
|
||||
{% endif %}
|
||||
{% csrf_token %}
|
||||
{% for field in form.visible_fields %}
|
||||
<div class="mb-3 {% if field.widget_type == 'checkbox' %}form-check{% endif %}">
|
||||
<label for="{{ field.id_for_label }}" class="form-label">{{ field.label }}</label>
|
||||
{{ field }}
|
||||
{% if field.help_text %}
|
||||
<div class="form-text">{{ field.help_text }}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
<button type="submit" class="btn btn-primary">Отправить</button>
|
||||
</form>
|
||||
{% endcomment %}
|
||||
<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: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" %}
|
||||
{% load static %}
|
||||
{% block title %}Регистрация{% endblock %}
|
||||
{% 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 %}
|
||||
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.models import Profile
|
||||
|
||||
|
||||
__all__ = []
|
||||
|
||||
|
||||
def signup(request):
|
||||
form = SignUpForm(request.POST)
|
||||
template = "users/signup.html"
|
||||
template = 'users/signup.html'
|
||||
context = {
|
||||
"form": form,
|
||||
'form': form,
|
||||
'text_button': 'Зарегистрироваться',
|
||||
}
|
||||
if request.method == 'GET':
|
||||
return render(request, template, context)
|
||||
@ -27,8 +27,8 @@ def signup(request):
|
||||
user.save()
|
||||
Profile.objects.create(user=user)
|
||||
user.profile.save()
|
||||
messages.success(request, _("Пользователь упешно создан"))
|
||||
return redirect(reverse("users:login"))
|
||||
messages.success(request, _('Пользователь упешно создан'))
|
||||
return redirect(reverse('users:login'))
|
||||
|
||||
return render(request, template, context)
|
||||
|
||||
@ -45,11 +45,12 @@ def profile(request):
|
||||
if request.method == 'GET':
|
||||
return render(
|
||||
request,
|
||||
"users/profile.html",
|
||||
'users/profile.html',
|
||||
{
|
||||
"profile_form": profile_form,
|
||||
"user_form": user_form,
|
||||
"user": request.user,
|
||||
'profile_form': profile_form,
|
||||
'user_form': user_form,
|
||||
'user': request.user,
|
||||
'text_button': 'Войти',
|
||||
},
|
||||
)
|
||||
|
||||
@ -59,37 +60,10 @@ def profile(request):
|
||||
|
||||
return render(
|
||||
request,
|
||||
"users/profile.html",
|
||||
'users/profile.html',
|
||||
{
|
||||
"profile_form": profile_form,
|
||||
"user_form": user_form,
|
||||
"user": request.user,
|
||||
'profile_form': profile_form,
|
||||
'user_form': user_form,
|
||||
'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)
|
||||
|
||||