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": (
"rest_framework.permissions.IsAuthenticated",
),
# "DEFAULT_AUTHENTICATION_CLASSES": (
# "rest_framework_simplejwt.authentication.JWTAuthentication",
# ),
"DEFAULT_AUTHENTICATION_CLASSES": (
"rest_framework_simplejwt.authentication.JWTAuthentication",
),
"DEFAULT_PAGINATION_CLASS": "rest_framework.pagination.LimitOffsetPagination",
"DEFAULT_FILTER_BACKENDS": (
"django_filters.rest_framework.DjangoFilterBackend",

View File

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

View File

@ -23,6 +23,16 @@
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 {
}
@ -32,6 +42,11 @@
padding: 0px 10px;
}
.main h1 {
text-align: center;
text-transform: uppercase;
}
.authContent {
top: 50%;
left: 50%;

View File

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

View File

@ -3,20 +3,15 @@
{% block title %}Home{% endblock %}
{% block content %}
<h1>Welcome in SOITA/h1>
<!-- TODO reading all tests from DB-->
{% for test in tests.all %}
<div class="test-infoBox">
<p><a href="/tests/{{test.id}}/show/">{{test.name}}</a></p>
</div>
{% endfor %}
<!-- {% 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 %}-->
<h1>Welcome in SOITA</h1>
{% for test in tests %}
<p>
<b>{{test.name}}</b>
<br>
Passing score: {{test.passing_score}}
<br>
Category: {{test.category.name}}
</p>
{% endfor %}
{% endblock %}