resolve merge conflicts
This commit is contained in:
commit
7a5c7faf91
@ -122,3 +122,6 @@ STATICFILES_DIRS = [
|
|||||||
|
|
||||||
MEDIA_ROOT = BASE_DIR / 'media'
|
MEDIA_ROOT = BASE_DIR / 'media'
|
||||||
MEDIA_URL = '/media/'
|
MEDIA_URL = '/media/'
|
||||||
|
LOGIN_REDIRECT_URL = '/'
|
||||||
|
LOGOUT_REDIRECT_URL = '/'
|
||||||
|
|
||||||
|
@ -15,15 +15,24 @@ Including another URLconf
|
|||||||
"""
|
"""
|
||||||
from django.conf.urls.static import static
|
from django.conf.urls.static import static
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.urls import path, include
|
|
||||||
|
|
||||||
|
from django.urls import path, include
|
||||||
|
from django.contrib.auth.views import LoginView
|
||||||
|
from django.urls import path, include
|
||||||
from access_controller import settings
|
from access_controller import settings
|
||||||
from main.views import *
|
from main.views import *
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('admin/', admin.site.urls, name='admin'),
|
path('admin/', admin.site.urls, name='admin'),
|
||||||
|
path('', main_page),
|
||||||
path('register/', CustomRegistrationView.as_view(), name='registration'),
|
path('register/', CustomRegistrationView.as_view(), name='registration'),
|
||||||
path('', include('django_registration.backends.one_step.urls')),
|
#path('', include('django_registration.backends.one_step.urls')),
|
||||||
path('profile/', profile_page, name='profile'),
|
path('profile/', profile_page, name='profile'),
|
||||||
]
|
path('accounts/login/', LoginView.as_view(extra_context={})), # TODO add extra context
|
||||||
|
path('accounts/', include('django.contrib.auth.urls'))
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||||
|
BIN
layouts/authorization/authorization.jpg
Normal file
BIN
layouts/authorization/authorization.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 27 KiB |
@ -1,33 +1,57 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
|
||||||
|
<html lang="ru" class="h-100">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<title>{% block title %}{% endblock %}</title>
|
<title>{% block title %}{% endblock %}</title>
|
||||||
<link
|
<link rel="stylesheet"
|
||||||
href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css"
|
href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css"
|
||||||
rel="stylesheet"
|
integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2"
|
||||||
integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1"
|
crossorigin="anonymous">
|
||||||
crossorigin="anonymous"
|
|
||||||
/>
|
<style>
|
||||||
|
.bd-placeholder-img {
|
||||||
|
font-size: 1.125rem;
|
||||||
|
text-anchor: middle;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-moz-user-select: none;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 768px) {
|
||||||
|
.bd-placeholder-img-lg {
|
||||||
|
font-size: 3.5rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
{% block extra_css %}{% endblock %}
|
{% block extra_css %}{% endblock %}
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body class="d-flex flex-column h-100">
|
||||||
<main>
|
{% include 'base/menu.html' %}
|
||||||
<div class="container">
|
|
||||||
<h1 class="mb-4">
|
|
||||||
{% block heading %}{% endblock %}
|
|
||||||
</h1>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="container" >
|
<main class="flex-shrink-0">
|
||||||
{% block content %}{% endblock %}
|
<div class="container mt-4 mb-4">
|
||||||
|
<h1 class="mb-4 text-center">
|
||||||
|
{% block heading %}
|
||||||
|
{% endblock %}
|
||||||
|
</h1>
|
||||||
|
{% block content %}
|
||||||
|
{% endblock %}
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
|
<footer class="footer mt-auto py-3 bg-light">
|
||||||
|
<div class="container">
|
||||||
|
<small class="text-muted mt-auto">Сайт сделан учениками Школы Программистов (Группа №02)</small>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
|
||||||
<script
|
<script
|
||||||
src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/js/bootstrap.bundle.min.js"
|
src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/js/bootstrap.bundle.min.js"
|
||||||
integrity="sha384-ygbV9kiqUc6oa4msXn9868pTtWMgiQaeYH7/t7LECLbyPA2x65Kgf80OJFdroafW"
|
integrity="sha384-ygbV9kiqUc6oa4msXn9868pTtWMgiQaeYH7/t7LECLbyPA2x65Kgf80OJFdroafW"
|
||||||
crossorigin="anonymous"
|
crossorigin="anonymous"
|
||||||
></script>
|
></script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
26
main/templates/base/menu.html
Normal file
26
main/templates/base/menu.html
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<header>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
|
|
||||||
|
<nav class="navbar navbar-light" style="background-color: #a3f2fd;">
|
||||||
|
<a class="navbar-brand" href="#">
|
||||||
|
<img src="media/images/access.png" width="30" height="30" class="d-inline-block align-top" alt="" loading="lazy">
|
||||||
|
Access Controller
|
||||||
|
</a>
|
||||||
|
{% if request.user.is_authenticated %}
|
||||||
|
|
||||||
|
<div class="btn-group" role="group" aria-label="Basic example">
|
||||||
|
<a class="btn btn-secondary" href="/accounts/logout">Выйти</a>
|
||||||
|
<a class="btn btn-secondary" href="">Профиль</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% else %}
|
||||||
|
|
||||||
|
<div class="btn-group" role="group" aria-label="Basic example">
|
||||||
|
<a class="btn btn-secondary" href="/accounts/login">Войти</a>
|
||||||
|
<a class="btn btn-secondary" href="/accounts/register">Зарегистрироваться</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
</nav>
|
||||||
|
</header>
|
17
main/templates/pages/index.html
Normal file
17
main/templates/pages/index.html
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{% extends 'base/base.html' %}
|
||||||
|
|
||||||
|
{% block title %}
|
||||||
|
Главная
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="d-flex h-300 text-center">
|
||||||
|
<div class="mt-5 d-flex w-50 h-300 p-3 mx-auto flex-column">
|
||||||
|
|
||||||
|
<h2 class="mt-4 mb-4">Добро пожаловать!</h2>
|
||||||
|
<h4 class=" mt-4">Мы рады приветствовать Вас на нашем сайте. Главная его задача - выдавать права пользователям системы по запросу самого
|
||||||
|
пользователя.</h4>
|
||||||
|
<h5 class="lead mt-4">Сайт использует API ZenDesk.</h5>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
40
main/templates/registration/login.html
Normal file
40
main/templates/registration/login.html
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
{% extends 'base/base.html' %}
|
||||||
|
{% block title %}
|
||||||
|
Авторизация
|
||||||
|
{% endblock %}
|
||||||
|
{% block heading %}
|
||||||
|
Авторизация
|
||||||
|
{% endblock %}
|
||||||
|
{% block content %}
|
||||||
|
<div class="container">
|
||||||
|
<div class="card mx-auto" style="width: 40rem">
|
||||||
|
<div class="card-body pb-0">
|
||||||
|
|
||||||
|
<form method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
{% for field in form %}
|
||||||
|
<label class="form-label" for="{{ field.id_for_label }}">{{ field.label }}</label>
|
||||||
|
<input
|
||||||
|
required=""
|
||||||
|
class="form-control mb-3"
|
||||||
|
id="{{ field.id_for_label }}"
|
||||||
|
name="{{ field.html_name }}"
|
||||||
|
type="{{ field.widget_type }}"
|
||||||
|
/>
|
||||||
|
{% endfor %}
|
||||||
|
{% if form.non_field_errors %}
|
||||||
|
<ul class='form-errors'>
|
||||||
|
{% for error in form.non_field_errors %}
|
||||||
|
<li>{{ error }}</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
{% endif %}
|
||||||
|
<div class="text-center">
|
||||||
|
<button type="submit" class="btn btn-primary">Войти</button>
|
||||||
|
<a href="" class="btn btn-link" style="display: block;">Забыли пароль?</a>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
@ -1,6 +1,7 @@
|
|||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.urls import reverse_lazy
|
from django.urls import reverse_lazy
|
||||||
|
|
||||||
|
|
||||||
from main.extra_func import set_and_get_name, set_and_get_email, load_and_get_image, set_and_get_role, check_user_exist, \
|
from main.extra_func import set_and_get_name, set_and_get_email, load_and_get_image, set_and_get_role, check_user_exist, \
|
||||||
check_user_auth
|
check_user_auth
|
||||||
from main.models import UserProfile
|
from main.models import UserProfile
|
||||||
@ -64,6 +65,7 @@ def profile_page(request):
|
|||||||
:return: объект ответа сервера с HTML-кодом внутри
|
:return: объект ответа сервера с HTML-кодом внутри
|
||||||
"""
|
"""
|
||||||
if request.user.is_authenticated:
|
if request.user.is_authenticated:
|
||||||
|
#UP = UserProfile.objects.get(user=request.user)
|
||||||
UP = UserProfile.objects.get(user=request.user)
|
UP = UserProfile.objects.get(user=request.user)
|
||||||
#else: # TODO: Убрать после появления регистрации и авторизации, добавить login_required()
|
#else: # TODO: Убрать после появления регистрации и авторизации, добавить login_required()
|
||||||
#UP = UserProfile.objects.get(user=1)
|
#UP = UserProfile.objects.get(user=1)
|
||||||
@ -75,3 +77,8 @@ def profile_page(request):
|
|||||||
'pagename': 'Страница профиля'
|
'pagename': 'Страница профиля'
|
||||||
}
|
}
|
||||||
return render(request, 'pages/profile.html', context)
|
return render(request, 'pages/profile.html', context)
|
||||||
|
|
||||||
|
|
||||||
|
def main_page(request):
|
||||||
|
return render(request, 'pages/index.html')
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user