BES-14 Add base, login and navbar front

This commit is contained in:
Th3NiKo 2019-11-24 14:17:22 +01:00
parent 538db4195b
commit 4c7649c77c
5 changed files with 105 additions and 0 deletions

29
Front/templates/base.html Normal file
View File

@ -0,0 +1,29 @@
<!doctype html>
<html lang="pl">
{% load static %}
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap 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" type="text/css" href="{% static 'navbar.css' %}">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
{% block css %}
{% endblock %}
<title>Best Notes</title>
</head>
<body>
{% block content %}
{% endblock %}
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<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.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
</body>
</html>

View File

@ -0,0 +1,16 @@
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
<a class="navbar-brand" href="#">
<i class="fa fa-sticky-note logo"></i>
<strong>Best Notes</strong>
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<ul class="navbar-nav collapse navbar-collapse" id="navbarNav">
<li class="nav-item nav-link" href="#">Strona główna <span class="sr-only">(current)</span></li>
{% if user.is_authenticated %}
<li class="nav-item nav-link active"><a class="nolink" href="{% url 'profesor' %}">Przedmioty</a></li>
<li class="nav-item nav-link"><a class="nolink" href="{% url 'logout' %}">Wyloguj się</a></li>
{% endif %}
</ul>
</nav>

View File

@ -0,0 +1,39 @@
{% extends 'base.html' %}
{% load widget_tweaks %}
{% load static %}
{% block css %}
<link rel="stylesheet" type="text/css" href="{% static 'login.css' %}">
{% endblock %}
{% block content %}
<div class="container login-container">
<div class="row justify-content-md-center">
<div class="col-md-6 login-form-2">
<i class="fa fa-sticky-note-o fa-5x logo"> </i>
<h1><strong>Best Notes</strong></h1>
<form method="post" action="{% url 'login' %}">
{% csrf_token %}
{% for hidden in form.hidden_fields %}
{{ hidden }}
{% endfor %}
{% if form.errors %}
<p class="text-warning">Nieprawidłowy adres e-mail lub hasło. Spróbuj ponownie!</p>
{% endif %}
<div class="input-group mb-3">
<div class="input-group-prepend"><i class="input-group-text fa fa-envelope fa-lg"></i></div>
{% render_field form.username class="form-control" placeholder="Email"%}
</div>
<div class="input-group">
<div class="input-group-prepend"><i class="input-group-text fa fa-lock fa-lg"></i></div>
{% render_field form.password class="form-control" placeholder="Hasło"%}
</div>
<div class="form-group mt-3">
<input type="submit" class="btnSubmit" value="Login" />
</div>
</form>
</div>
</div>
</div>
{% endblock %}

10
Front/urls.py Normal file
View File

@ -0,0 +1,10 @@
from django.urls import path, include
from . import views
urlpatterns = [
path('/', views.login),
path('accounts/', include("django.contrib.auth.urls")),
path('profesor/', views.profesor, name="profesor"),
path('profesor/<id>', views.profesor_id),
]

11
Front/views.py Normal file
View File

@ -0,0 +1,11 @@
from django.shortcuts import render
# Create your views here.
def login(request):
return render(request, "login.html", {})
def profesor(request):
return render(request, "profesor.html", {})
def profesor_id(request,id):
return render(request, "przedmiot.html", {'id': id})