From 3855520a7028ed8dee47c63fc57ca13e67fd3d61 Mon Sep 17 00:00:00 2001 From: Piotr Kopycki Date: Wed, 8 Dec 2021 19:28:56 +0100 Subject: [PATCH] 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 %} +