Base template first try

This commit is contained in:
Piotr Kopycki 2021-12-08 19:28:56 +01:00
parent d9da12f26d
commit 3855520a70
8 changed files with 79 additions and 2 deletions

6
.gitignore vendored
View File

@ -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

View File

@ -36,6 +36,7 @@ DEBUG = get_secret("DEBUG")
ALLOWED_HOSTS = get_secret("ALLOWED_HOSTS")
APPEND_SLASH = False
# Application definition

View File

@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>SOITA | {% block title %}{% endblock %}</title>
<meta name="description" content="{% block description %}{% endblock %}">
</head>
<body>
{% block content %}
{% endblock %}
</body>
</html>

View File

@ -0,0 +1,15 @@
{% extends "base.html" %}
{% block title %}Home{% endblock %}
{% block content %}
<h1>Welcome in SOITA/h1>
{% if user.is_authenticated %}
<p>Username: {{user.username}}</p>
<p>Name: {{user.first_name}} {{user.last_name}}</p>
<p>Email: {{user.email}}</p>
{% else %}
Guest nr 123
{% endif %}
{% endblock %}

View File

@ -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")),

10
config/views.py Normal file
View File

@ -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')

16
templates/base.html Normal file
View File

@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>SOITA | {% block title %}{% endblock %}</title>
<meta name="description" content="{% block description %}{% endblock %}">
</head>
<body>
{% block content %}
{% endblock %}
</body>
</html>

15
templates/index.html Normal file
View File

@ -0,0 +1,15 @@
{% extends "base.html" %}
{% block title %}Home{% endblock %}
{% block content %}
<h1>Welcome in SOITA/h1>
{% if user.is_authenticated %}
<p>Username: {{user.username}}</p>
<p>Name: {{user.first_name}} {{user.last_name}}</p>
<p>Email: {{user.email}}</p>
{% else %}
Guest nr 123
{% endif %}
{% endblock %}