From 3855520a7028ed8dee47c63fc57ca13e67fd3d61 Mon Sep 17 00:00:00 2001 From: Piotr Kopycki Date: Wed, 8 Dec 2021 19:28:56 +0100 Subject: [PATCH 1/4] Base template first try --- .gitignore | 6 ++++-- config/settings.py | 1 + config/templates/base.html | 16 ++++++++++++++++ config/templates/index.html | 15 +++++++++++++++ config/urls.py | 2 ++ config/views.py | 10 ++++++++++ templates/base.html | 16 ++++++++++++++++ templates/index.html | 15 +++++++++++++++ 8 files changed, 79 insertions(+), 2 deletions(-) create mode 100644 config/templates/base.html create mode 100644 config/templates/index.html create mode 100644 config/views.py create mode 100644 templates/base.html create mode 100644 templates/index.html diff --git a/.gitignore b/.gitignore index aac87cd..31d976d 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,8 @@ media # Backup files # *.bak -# If you are using PyCharm # +# If you are using PyCharm # +.idea/ # User-specific stuff .idea/**/workspace.xml .idea/**/tasks.xml @@ -103,7 +104,8 @@ env/ venv/ ENV/ env.bak/ -venv.bak/ +venv.bak/ +soita-venv/ # mkdocs documentation /site diff --git a/config/settings.py b/config/settings.py index b6a07f7..dac18de 100644 --- a/config/settings.py +++ b/config/settings.py @@ -36,6 +36,7 @@ DEBUG = get_secret("DEBUG") ALLOWED_HOSTS = get_secret("ALLOWED_HOSTS") +APPEND_SLASH = False # Application definition diff --git a/config/templates/base.html b/config/templates/base.html new file mode 100644 index 0000000..09c3505 --- /dev/null +++ b/config/templates/base.html @@ -0,0 +1,16 @@ + + + + + + SOITA | {% block title %}{% endblock %} + + + + + {% block content %} + {% endblock %} + + + + diff --git a/config/templates/index.html b/config/templates/index.html new file mode 100644 index 0000000..393c280 --- /dev/null +++ b/config/templates/index.html @@ -0,0 +1,15 @@ +{% extends "base.html" %} + +{% block title %}Home{% endblock %} + +{% block content %} +

Welcome in SOITA/h1> + {% if user.is_authenticated %} +

Username: {{user.username}}

+

Name: {{user.first_name}} {{user.last_name}}

+

Email: {{user.email}}

+ {% else %} + Guest nr 123 + {% endif %} +{% endblock %} + diff --git a/config/urls.py b/config/urls.py index a40f86d..ee67220 100644 --- a/config/urls.py +++ b/config/urls.py @@ -16,8 +16,10 @@ Including another URLconf from django.contrib import admin from django.urls import include from django.urls import path +from .views import index urlpatterns = [ + path('', index), path('users/', include("users.urls")), path('questions/', include("questions.urls")), path('answers/', include("answers.urls")), diff --git a/config/views.py b/config/views.py new file mode 100644 index 0000000..02bfdd5 --- /dev/null +++ b/config/views.py @@ -0,0 +1,10 @@ +from django.shortcuts import render, redirect +from django.template import loader + + + +def index(request): + # context = { + # 'latest_question_list': latest_question_list, + # } + return render(request, 'index.html') \ No newline at end of file diff --git a/templates/base.html b/templates/base.html new file mode 100644 index 0000000..09c3505 --- /dev/null +++ b/templates/base.html @@ -0,0 +1,16 @@ + + + + + + SOITA | {% block title %}{% endblock %} + + + + + {% block content %} + {% endblock %} + + + + diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..393c280 --- /dev/null +++ b/templates/index.html @@ -0,0 +1,15 @@ +{% extends "base.html" %} + +{% block title %}Home{% endblock %} + +{% block content %} +

Welcome in SOITA/h1> + {% if user.is_authenticated %} +

Username: {{user.username}}

+

Name: {{user.first_name}} {{user.last_name}}

+

Email: {{user.email}}

+ {% else %} + Guest nr 123 + {% endif %} +{% endblock %} + From c53268384319ebba1dec83dab7b29d56643e46ad Mon Sep 17 00:00:00 2001 From: Hubert Jankowski Date: Wed, 8 Dec 2021 20:37:29 +0100 Subject: [PATCH 2/4] added templates in list --- config/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/settings.py b/config/settings.py index dac18de..1c49906 100644 --- a/config/settings.py +++ b/config/settings.py @@ -68,7 +68,7 @@ ROOT_URLCONF = get_secret("ROOT_URLCONF") TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': os.path.join(BASE_DIR, "templates"), + 'DIRS': [os.path.join(BASE_DIR, "templates")], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ From 2be89b6901b0e0cfbfcabf5e3536b49cec0a9410 Mon Sep 17 00:00:00 2001 From: Piotr Kopycki Date: Thu, 9 Dec 2021 23:25:35 +0100 Subject: [PATCH 3/4] Templates update --- config/templates/base.html | 16 ---------- config/templates/index.html | 15 --------- config/urls.py | 5 ++- config/views.py | 21 +++++++++++-- palette.txt | 6 ++++ static/style.css | 62 +++++++++++++++++++++++++++++++++++++ templates/authBase.html | 24 ++++++++++++++ templates/base.html | 60 ++++++++++++++++++++++++++++++++--- templates/index.html | 21 ++++++++----- templates/login.html | 8 +++++ templates/logout.html | 8 +++++ templates/register.html | 8 +++++ 12 files changed, 208 insertions(+), 46 deletions(-) delete mode 100644 config/templates/base.html delete mode 100644 config/templates/index.html create mode 100644 palette.txt create mode 100644 static/style.css create mode 100644 templates/authBase.html create mode 100644 templates/login.html create mode 100644 templates/logout.html create mode 100644 templates/register.html diff --git a/config/templates/base.html b/config/templates/base.html deleted file mode 100644 index 09c3505..0000000 --- a/config/templates/base.html +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - SOITA | {% block title %}{% endblock %} - - - - - {% block content %} - {% endblock %} - - - - diff --git a/config/templates/index.html b/config/templates/index.html deleted file mode 100644 index 393c280..0000000 --- a/config/templates/index.html +++ /dev/null @@ -1,15 +0,0 @@ -{% extends "base.html" %} - -{% block title %}Home{% endblock %} - -{% block content %} -

Welcome in SOITA/h1> - {% if user.is_authenticated %} -

Username: {{user.username}}

-

Name: {{user.first_name}} {{user.last_name}}

-

Email: {{user.email}}

- {% else %} - Guest nr 123 - {% endif %} -{% endblock %} - diff --git a/config/urls.py b/config/urls.py index ee67220..49df139 100644 --- a/config/urls.py +++ b/config/urls.py @@ -16,10 +16,13 @@ Including another URLconf from django.contrib import admin from django.urls import include from django.urls import path -from .views import index +from .views import index, login, logout, register urlpatterns = [ path('', index), + path('login/', login), + path('logout/', logout), + path('register/', register), path('users/', include("users.urls")), path('questions/', include("questions.urls")), path('answers/', include("answers.urls")), diff --git a/config/views.py b/config/views.py index 02bfdd5..a8668ef 100644 --- a/config/views.py +++ b/config/views.py @@ -2,9 +2,26 @@ from django.shortcuts import render, redirect from django.template import loader - def index(request): # context = { # 'latest_question_list': latest_question_list, # } - return render(request, 'index.html') \ No newline at end of file + return render(request, 'index.html') + +def login(request): + # context = { + # 'latest_question_list': latest_question_list, + # } + return render(request, 'login.html') + +def logout(request): + # context = { + # 'latest_question_list': latest_question_list, + # } + return render(request, 'logout.html') + +def register(request): + # context = { + # 'latest_question_list': latest_question_list, + # } + return render(request, 'register.html') \ No newline at end of file diff --git a/palette.txt b/palette.txt new file mode 100644 index 0000000..b17e486 --- /dev/null +++ b/palette.txt @@ -0,0 +1,6 @@ +Color palette: +#00916E - Illuminating Emerald +#FEEFE5 - Linen +#FFCF00 - Cyber Yellow +#EE6123 - Orange Panteon +#FA003F - Red Munsell \ No newline at end of file diff --git a/static/style.css b/static/style.css new file mode 100644 index 0000000..351f299 --- /dev/null +++ b/static/style.css @@ -0,0 +1,62 @@ +.sidenav { + height: 100%; + width: 160px; + position: fixed; + z-index: 1; + top: 0; + left: 0; + background-color: #FA003F; + overflow-x: :hidden; + padding-top: 20px; +} + +.sidenav a { + padding: 6px 8px 6px 16px; + text-decoration: none; + font-size: 20px; + color: #FEEFE5; + display: block; + line-height: 1.6; +} + +.sidenav a:hover { + color: #00916E; +} + +.main { + margin-left: 160px; + padding: 0px 10px; +} + +.authBox { + height: 100px; + width: 100px; + background-color: #FEEFE5; + color: #111; + padding: 250px 300px 0px 300px; + position: relative; +} + +.authContent { + background-color:#FA003F + padding: 250px 300px 0px 300px; + height: 100%; + width: 100%; + position: absolute; +} + +.titleBar { + height: 50px; + width: 100%; + position: fixed; + z-index: 1; + top: 0; + left: 0; + background-color: #2B3D41; + padding-top: 20px; + text-align: center; + text-decoration: none; + font-size: 30px; + color: #FEEFE5; + display: block; +} \ No newline at end of file diff --git a/templates/authBase.html b/templates/authBase.html new file mode 100644 index 0000000..93dda44 --- /dev/null +++ b/templates/authBase.html @@ -0,0 +1,24 @@ + +{% load static %} + + + + + SOITA | {% block title %}{% endblock %} + + + + +
+ SOITA +
+
+
+ {% block content %} + {% endblock %} +
+
+ + + + diff --git a/templates/base.html b/templates/base.html index 09c3505..8bb1cab 100644 --- a/templates/base.html +++ b/templates/base.html @@ -1,15 +1,65 @@ +{% load static %} - + + + + + + + + + + + + + + - SOITA | {% block title %}{% endblock %} - + + + + + + + + + + + + + + + + + + + + SOITA | {% block title %}{% endblock %} + - {% block content %} - {% endblock %} + + +
+ {% block content %} + {% endblock %} +
diff --git a/templates/index.html b/templates/index.html index 393c280..fdeba24 100644 --- a/templates/index.html +++ b/templates/index.html @@ -4,12 +4,19 @@ {% block content %}

Welcome in SOITA/h1> - {% if user.is_authenticated %} -

Username: {{user.username}}

-

Name: {{user.first_name}} {{user.last_name}}

-

Email: {{user.email}}

- {% else %} - Guest nr 123 - {% endif %} + + {% for test in tests.all %} + + + {% endfor %} + + + + + + + {% endblock %} diff --git a/templates/login.html b/templates/login.html new file mode 100644 index 0000000..8de3b06 --- /dev/null +++ b/templates/login.html @@ -0,0 +1,8 @@ +{% extends "authBase.html" %} + +{% block title %}Login{% endblock %} + +{% block content %} + Login +{% endblock %} + diff --git a/templates/logout.html b/templates/logout.html new file mode 100644 index 0000000..9e910f2 --- /dev/null +++ b/templates/logout.html @@ -0,0 +1,8 @@ +{% extends "authBase.html" %} + +{% block title %}Logout{% endblock %} + +{% block content %} + Logout +{% endblock %} + diff --git a/templates/register.html b/templates/register.html new file mode 100644 index 0000000..f9756d8 --- /dev/null +++ b/templates/register.html @@ -0,0 +1,8 @@ +{% extends "authBase.html" %} + +{% block title %}Create account{% endblock %} + +{% block content %} + Create account +{% endblock %} + From fa65947965fa3c55ad938ff7861dc1ef6d1086a5 Mon Sep 17 00:00:00 2001 From: Piotr Kopycki Date: Fri, 10 Dec 2021 15:39:22 +0100 Subject: [PATCH 4/4] Authentication pages --- static/style.css | 71 ++++++++++++++++++++++++++++++++++------- templates/authBase.html | 10 +++--- templates/login.html | 12 +++++-- templates/logout.html | 4 +-- templates/register.html | 16 +++++++++- 5 files changed, 90 insertions(+), 23 deletions(-) diff --git a/static/style.css b/static/style.css index 351f299..056942f 100644 --- a/static/style.css +++ b/static/style.css @@ -28,21 +28,66 @@ padding: 0px 10px; } -.authBox { - height: 100px; - width: 100px; +.authContent { + top: 50%; + left: 50%; + position: absolute; + width: 400px; + height: 550px; + padding: 80px 40px; background-color: #FEEFE5; - color: #111; - padding: 250px 300px 0px 300px; - position: relative; + -webkit-transform: translate(-50%,-50%); + -moz-transform: translate(-50%,-50%); + -ms-transform: translate(-50%,-50%); + -o-transform: translate(-50%,-50%); + transform: translate(-50%,-50%); + color: #2B3D41; } -.authContent { - background-color:#FA003F - padding: 250px 300px 0px 300px; - height: 100%; +.authContent h2 { + margin: 0; + padding: 0 0 20px; + text-align: center; + text-transform: uppercase; +} + +.authContent p { + margin: 0; + padding: 0; + font-weight: bold; + line-height: 1.5; +} + +.authContent input { width: 100%; - position: absolute; + margin-bottom: 20px; +} + +.authContent input[type=text], +.authContent input[type=email], +.authContent input[type=password]{ + border: none; + border-bottom: 1px solid #2B3D41;; + background: transparent; + outline: none; + height: 35px; + color: #2B3D41;; +} + +.authContent input[type=submit]{ + height: 30px; + color: #FFF; + font-size: 15px; + background: #00916E; + cursor: pointer; + border-radius: 25px; + border: none; + outline: none; + margin-top: 15px; +} + +input[type=checkbox]{ + width: 20%; } .titleBar { @@ -59,4 +104,6 @@ font-size: 30px; color: #FEEFE5; display: block; -} \ No newline at end of file +} + +background-color:#FA003F diff --git a/templates/authBase.html b/templates/authBase.html index 93dda44..6b6cc90 100644 --- a/templates/authBase.html +++ b/templates/authBase.html @@ -8,15 +8,13 @@ - +
SOITA
-
-
- {% block content %} - {% endblock %} -
+
+ {% block content %} + {% endblock %}
diff --git a/templates/login.html b/templates/login.html index 8de3b06..a8442a1 100644 --- a/templates/login.html +++ b/templates/login.html @@ -1,8 +1,16 @@ {% extends "authBase.html" %} -{% block title %}Login{% endblock %} +{% block title %}Log In{% endblock %} {% block content %} - Login +

Log In

+
+

Email

+ +

Password

+ + +

Remember Me

+
{% endblock %} diff --git a/templates/logout.html b/templates/logout.html index 9e910f2..b1f4349 100644 --- a/templates/logout.html +++ b/templates/logout.html @@ -1,8 +1,8 @@ {% extends "authBase.html" %} -{% block title %}Logout{% endblock %} +{% block title %}Log Out{% endblock %} {% block content %} - Logout +

You have been logged out successfully

{% endblock %} diff --git a/templates/register.html b/templates/register.html index f9756d8..a5a39b6 100644 --- a/templates/register.html +++ b/templates/register.html @@ -3,6 +3,20 @@ {% block title %}Create account{% endblock %} {% block content %} - Create account +

Register

+
+

First Name

+ +

Last Name

+ +

Email

+ +

Password

+ +

Repeat password

+ + +

Remember Me

+
{% endblock %}