Home page update

This commit is contained in:
Piotr Kopycki 2021-12-23 14:03:12 +01:00
parent 1a34329937
commit 74adb6f19b
5 changed files with 48 additions and 30 deletions

View File

@ -116,9 +116,9 @@ REST_FRAMEWORK = {
"DEFAULT_PERMISSION_CLASSES": ( "DEFAULT_PERMISSION_CLASSES": (
"rest_framework.permissions.IsAuthenticated", "rest_framework.permissions.IsAuthenticated",
), ),
# "DEFAULT_AUTHENTICATION_CLASSES": ( "DEFAULT_AUTHENTICATION_CLASSES": (
# "rest_framework_simplejwt.authentication.JWTAuthentication", "rest_framework_simplejwt.authentication.JWTAuthentication",
# ), ),
"DEFAULT_PAGINATION_CLASS": "rest_framework.pagination.LimitOffsetPagination", "DEFAULT_PAGINATION_CLASS": "rest_framework.pagination.LimitOffsetPagination",
"DEFAULT_FILTER_BACKENDS": ( "DEFAULT_FILTER_BACKENDS": (
"django_filters.rest_framework.DjangoFilterBackend", "django_filters.rest_framework.DjangoFilterBackend",

View File

@ -1,14 +1,17 @@
from django.shortcuts import render, redirect from django.shortcuts import render, redirect
from django.template import loader from django.template import loader
from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required
from trials.models import Test
@login_required @login_required
def home(request): def home(request):
context = {}
context['tests'] = Test.objects.all
# context = { # context = {
# 'latest_question_list': latest_question_list, # 'latest_question_list': latest_question_list,
# } # }
return render(request, 'home.html') return render(request, 'home.html', context)
def welcome(request): def welcome(request):

View File

@ -23,6 +23,16 @@
color: #00916E; color: #00916E;
} }
.sidenav p {
padding: 6px 8px 6px 16px;
text-decoration: none;
font-size: 20px;
color: #FEEFE5;
display: block;
line-height: 1.6;
text-transform: uppercase;
}
.sidenav-footer { .sidenav-footer {
} }
@ -32,6 +42,11 @@
padding: 0px 10px; padding: 0px 10px;
} }
.main h1 {
text-align: center;
text-transform: uppercase;
}
.authContent { .authContent {
top: 50%; top: 50%;
left: 50%; left: 50%;

View File

@ -43,17 +43,22 @@
<body> <body>
<div class="sidenav"> <div class="sidenav">
<a href="/">Home</a> <a href="/">Home</a>
<a href="/about">About</a> <a href="/test/create">Create test</a>
<a href="/tests/category/1">Category1</a> <a href="/users/tests">Your tests</a>
<a href="/tests/category/2">Category2</a> <p>Categories</p>
<a href="/tests/category/3">Category3</a> <a href="/tests/category/1">Język polski</a>
<a href="/tests/category/4">Category4</a> <a href="/tests/category/2">Język angielski</a>
<a href="/tests/category/5">Category5</a> <a href="/tests/category/3">Język niemiecki</a>
<a href="/tests/category/6">Category6</a> <a href="/tests/category/4">Matematyka</a>
<a href="/tests/category/7">Category7</a> <a href="/tests/category/5">Informatyka</a>
<a href="/tests/category/8">Category8</a> <a href="/tests/category/6">Fizyka</a>
<a href="/tests/category/9">Category9</a> <a href="/tests/category/7">Chemia</a>
<a href="/tests/category/10">Category10</a> <a href="/tests/category/8">Biologia</a>
<a href="/tests/category/9">Geografia</a>
<a href="/tests/category/10">Historia</a>
<p>Account</p>
<a href="/users/account">Settings</a>
<a href="/users/logout">Logout</a>
</div> </div>
<div id="content", name="content", class="main"> <div id="content", name="content", class="main">

View File

@ -3,20 +3,15 @@
{% block title %}Home{% endblock %} {% block title %}Home{% endblock %}
{% block content %} {% block content %}
<h1>Welcome in SOITA/h1> <h1>Welcome in SOITA</h1>
<!-- TODO reading all tests from DB--> {% for test in tests %}
{% for test in tests.all %} <p>
<div class="test-infoBox"> <b>{{test.name}}</b>
<p><a href="/tests/{{test.id}}/show/">{{test.name}}</a></p> <br>
</div> Passing score: {{test.passing_score}}
<br>
{% endfor %} Category: {{test.category.name}}
<!-- {% if user.is_authenticated %}--> </p>
<!-- <p>Username: {{user.username}}</p>--> {% endfor %}
<!-- <p>Name: {{user.first_name}} {{user.last_name}}</p>-->
<!-- <p>Email: {{user.email}}</p>-->
<!-- {% else %}-->
<!-- Guest nr 123-->
<!-- {% endif %}-->
{% endblock %} {% endblock %}