diff --git a/Palto/Palto/static/Palto/css/login.css b/Palto/Palto/static/Palto/css/login.css
new file mode 100644
index 0000000..685aa02
--- /dev/null
+++ b/Palto/Palto/static/Palto/css/login.css
@@ -0,0 +1,11 @@
+#login-form {
+ position: fixed;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+}
+
+#login-form input {
+ box-sizing: border-box;
+ width: 100%;
+}
\ No newline at end of file
diff --git a/Palto/Palto/templates/Palto/homepage.html b/Palto/Palto/templates/Palto/homepage.html
index 0795085..1511b54 100644
--- a/Palto/Palto/templates/Palto/homepage.html
+++ b/Palto/Palto/templates/Palto/homepage.html
@@ -1,6 +1,8 @@
-{% extends "Palto/base.html" %}
+{% extends "Palto/base/base-features.html" %}
{% block body %}
+ {{ block.super }}
+
Palto
diff --git a/Palto/Palto/templates/Palto/login.html b/Palto/Palto/templates/Palto/login.html
index 7221a98..6094857 100644
--- a/Palto/Palto/templates/Palto/login.html
+++ b/Palto/Palto/templates/Palto/login.html
@@ -12,7 +12,7 @@
diff --git a/Palto/Palto/templates/Palto/profile.html b/Palto/Palto/templates/Palto/profile.html
index e879b97..3c8397e 100644
--- a/Palto/Palto/templates/Palto/profile.html
+++ b/Palto/Palto/templates/Palto/profile.html
@@ -1,7 +1,9 @@
-{% extends "Palto/base.html" %}
+{% extends "Palto/base/base-features.html" %}
{% load dict_tags %}
{% block body %}
+ {{ block.super }}
+
{{ profile.username }}
{{ profile.email }}
{% if profile.is_superuser %}Administrator{% endif %}
diff --git a/Palto/Palto/templates/Palto/student_group.html b/Palto/Palto/templates/Palto/student_group.html
index 56de3b0..0a7543f 100644
--- a/Palto/Palto/templates/Palto/student_group.html
+++ b/Palto/Palto/templates/Palto/student_group.html
@@ -1,6 +1,8 @@
-{% extends "Palto/base.html" %}
+{% extends "Palto/base/base-features.html" %}
{% block body %}
+ {{ block.super }}
+
{# group's information #}
diff --git a/Palto/Palto/templates/Palto/teaching_session_list.html b/Palto/Palto/templates/Palto/teaching_session_list.html
index 715d933..370008c 100644
--- a/Palto/Palto/templates/Palto/teaching_session_list.html
+++ b/Palto/Palto/templates/Palto/teaching_session_list.html
@@ -1,6 +1,7 @@
-{% extends "Palto/base.html" %}
+{% extends "Palto/base/base-features.html" %}
{% block body %}
+ {{ block.super }}
{# table of all the sessions #}
diff --git a/Palto/Palto/templates/Palto/teaching_session_view.html b/Palto/Palto/templates/Palto/teaching_session_view.html
index ada42aa..0901425 100644
--- a/Palto/Palto/templates/Palto/teaching_session_view.html
+++ b/Palto/Palto/templates/Palto/teaching_session_view.html
@@ -1,7 +1,9 @@
-{% extends "Palto/base.html" %}
+{% extends "Palto/base/base-features.html" %}
{% load dict_tags %}
{% block body %}
+ {{ block.super }}
+
{# session's information #}
diff --git a/Palto/Palto/templates/Palto/teaching_unit_view.html b/Palto/Palto/templates/Palto/teaching_unit_view.html
index 956aa5c..fb1716f 100644
--- a/Palto/Palto/templates/Palto/teaching_unit_view.html
+++ b/Palto/Palto/templates/Palto/teaching_unit_view.html
@@ -1,7 +1,9 @@
-{% extends "Palto/base.html" %}
+{% extends "Palto/base/base-features.html" %}
{% load dict_tags %}
{% block body %}
+ {{ block.super }}
+
{# unit's information #}
diff --git a/Palto/Palto/views.py b/Palto/Palto/views.py
index 85d67e1..3b0de87 100644
--- a/Palto/Palto/views.py
+++ b/Palto/Palto/views.py
@@ -24,24 +24,28 @@ def homepage_view(request: WSGIRequest):
def login_view(request: WSGIRequest):
# create a login form
- form_login = forms.LoginForm(request.POST)
- if form_login.is_valid():
- # try to authenticate this user with the credentials
- user = authenticate(
- username=form_login.cleaned_data["username"],
- password=form_login.cleaned_data["password"]
- )
+ if request.POST:
+ form_login = forms.LoginForm(request.POST)
- if user is not None:
- # if the user was authenticated, log the user in.
- login(request, user)
- # redirect him to the main page
- return redirect("Palto:homepage")
+ if form_login.is_valid():
+ # try to authenticate this user with the credentials
+ user = authenticate(
+ username=form_login.cleaned_data["username"],
+ password=form_login.cleaned_data["password"]
+ )
- else:
- # otherwise the credentials were invalid.
- form_login.add_error(field=None, error="Invalid credentials.")
+ if user is not None:
+ # if the user was authenticated, log the user in.
+ login(request, user)
+ # redirect him to the main page
+ return redirect("Palto:homepage")
+
+ else:
+ # otherwise the credentials were invalid.
+ form_login.add_error(field=None, error="Invalid credentials.")
+ else:
+ form_login = forms.LoginForm()
# return the page
return render(