Commit f217ed60 authored by Борис Ким's avatar Борис Ким

Сделал ссылку на логин и отображение пользователя в главном меню

parent 8241ef34
......@@ -6,5 +6,6 @@ app_name = "accounts"
urlpatterns = [
path('login/', accounts_views.LoginView.as_view(), name="login")
path('login/', accounts_views.LoginView.as_view(), name="login"),
path('logout/', accounts_views.LogoutView.as_view(), name="logout"),
]
......@@ -129,5 +129,7 @@ MEDIA_URL = '/media/'
CRISPY_TEMPLATE_PACK = 'bootstrap4'
LOGIN_URL = '/accounts/login/'
LOGIN_REDIRECT_URL = '/'
LOGOUT_REDIRECT_URL = '/'
\ No newline at end of file
......@@ -7,10 +7,12 @@
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="{% static 'css/main.css' %}" type="text/css">
<link href="{% static 'fontawesomefree/css/all.min.css' %}" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.0/css/all.css" integrity="sha384-lZN37f5QGtY3VHgisS14W3ExzMWZxybE1SJSEsQp9S+oqd12jhcu+A56Ebc1zFSJ" crossorigin="anonymous">
<title>{% block title %}{% endblock %}</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
<title>{% block title %} University {% endblock %}</title>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
......@@ -34,6 +36,26 @@
</li>
</ul>
</div>
{% if user.is_authenticated %}
<div class="dropdown">
<a class="dropdown-toggle" style="color: white;" type="button" id="dropdownMenu2" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
{{ user.username }} <i class="fas fa-user"></i>
</a>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownMenu2">
<button class="dropdown-item" type="button">Profile</button>
<button class="dropdown-item" type="button">Students</button>
<div class="dropdown-divider"></div>
<form action="{% url 'accounts:logout' %}" method="POST">
{% csrf_token %}
<button class="dropdown-item">Logout</button>
</form>
</div>
</div>
{% else %}
<div>
<a href="{% url 'accounts:login' %}">Sign in</a>
</div>
{% endif %}
</nav>
<div class="row d-flex">
<div class="sidebar col-2">
......
{% extends 'base.html' %}
{% block title %} List {% endblock %}
{% block title %} University {% endblock %}
{% block content %}
<div class='course-container row d-flex flex-wrap justify-content-start'>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment