update

parent 58f07dd0
......@@ -6,10 +6,12 @@
<body>
<nav class="navbar sticky-top navbar-dark bg-success">
<a class="navbar-brand" href="{% url 'index' %}"> PyPrevention </a>
{% load static %}
<a class="navbar-brand" href="{% url 'index' %}">
<img width="30" height="30" src="{% static "heart.png" %}" alt="icon"> PyPrevention </a>
<center>
<a class="btn btn-light" type="button" href="">Link 1</a>
<a class="btn btn-light" type="button" href="">Link 2</a>
<a class="btn btn-dark" type="button" href="">Link 1</a>
<a class="btn btn-dark" type="button" href="">Link 2</a>
</center>
{% if user.is_authenticated %}
<div class="dropdown show">
......@@ -17,14 +19,14 @@
{{ user.username}}
</a>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownMenuLink">
<a class="dropdown-item" href="">Mon profil</a>
<a class="dropdown-item text-danger" href="">Se déconnecter</a>
<div class="dropdown-menu dropdown-menu-left" aria-labelledby="dropdownMenuLink">
<a class="dropdown-item" href="">Mon profile</a>
<a class="dropdown-item text-danger" href="{% url 'logout' %}">Se déconnecter</a>
</div>
</div>
{% else %}
<a class="btn btn-success" href="{% url 'login' %}">Se connecter</a>
<a class="btn btn-success" href="{% url 'admin' %}">Se connecter</a>
{% endif %}
</nav>
......
......@@ -6,5 +6,6 @@ from django.contrib import admin
urlpatterns = [
path('', views.index, name='index'),
path('api', views.api, name='api'),
path('logout', views.logout_view, name='logout'),
url(r'^accounts/login/$', views.login, name='login'),
]
from django.shortcuts import render
from django.shortcuts import render, redirect
from django.http import HttpResponse
from django.contrib.auth.decorators import login_required
from django.contrib.auth import logout
# Create your views here.
@login_required
def logout_view(request):
logout(request)
return redirect('/')
def index(request):
return render(request, 'home.html')
......
No preview for this file type
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