Questionnaire
This commit is contained in:
parent
dd22e1ca83
commit
5525476218
@ -63,7 +63,8 @@ INSTALLED_APPS = [
|
||||
"answers",
|
||||
"questions",
|
||||
"categories",
|
||||
"tools"
|
||||
"tools",
|
||||
"questionnaire"
|
||||
]
|
||||
# AUTHENTICATION_BACKENDS = ['config.authh.SettingsBackend']
|
||||
MIDDLEWARE = [
|
||||
|
@ -30,6 +30,7 @@ urlpatterns = [
|
||||
path('answers/', include("answers.urls")),
|
||||
path('tests/', include("trials.urls")),
|
||||
path('category/', include("categories.urls")),
|
||||
path('questionnaire/', include("questionnaire.urls")),
|
||||
]
|
||||
|
||||
urlpatterns += staticfiles_urlpatterns()
|
||||
|
@ -33,6 +33,5 @@ def hard(request):
|
||||
context['tests'] = sorted(context['tests'], key=operator.attrgetter('difficulty_label'), reverse=True)
|
||||
return render(request, 'hard.html', context)
|
||||
|
||||
|
||||
def welcome(request):
|
||||
return render(request, 'welcome.html')
|
||||
|
0
questionnaire/__init__.py
Normal file
0
questionnaire/__init__.py
Normal file
0
questionnaire/apps.py
Normal file
0
questionnaire/apps.py
Normal file
22
questionnaire/managers.py
Normal file
22
questionnaire/managers.py
Normal file
@ -0,0 +1,22 @@
|
||||
from django.db.models import Manager
|
||||
from django.apps import apps
|
||||
from django.conf import settings
|
||||
|
||||
class QuestionnaireManager(Manager):
|
||||
|
||||
def create(
|
||||
self,
|
||||
**kwargs
|
||||
):
|
||||
instance = super().create(
|
||||
overall=kwargs.get("overall"),
|
||||
functionality=kwargs.get("functionality"),
|
||||
look=kwargs.get("look"),
|
||||
intuitive=kwargs.get("intuitive"),
|
||||
bugs=kwargs.get("bugs"),
|
||||
tech=kwargs.get("tech"),
|
||||
potential=kwargs.get("potential"),
|
||||
worst=kwargs.get("worst"),
|
||||
desc=kwargs.get("desc"),
|
||||
)
|
||||
return instance
|
0
questionnaire/migrations/__init__.py
Normal file
0
questionnaire/migrations/__init__.py
Normal file
22
questionnaire/models.py
Normal file
22
questionnaire/models.py
Normal file
@ -0,0 +1,22 @@
|
||||
from django.db import models
|
||||
|
||||
from .managers import QuestionnaireManager
|
||||
|
||||
|
||||
class Questionnaire(models.Model):
|
||||
overall = models.IntegerField(default=0)
|
||||
functionality = models.IntegerField(default=0)
|
||||
look = models.IntegerField(default=0)
|
||||
intuitive = models.IntegerField(default=0)
|
||||
bugs = models.IntegerField(default=0)
|
||||
tech = models.IntegerField(default=0)
|
||||
potential = models.IntegerField(default=0)
|
||||
worst = models.IntegerField(default=0)
|
||||
desc = models.CharField(max_length=255, default="")
|
||||
fill_by = models.ForeignKey(
|
||||
"users.User",
|
||||
null=True,
|
||||
related_name="questionnaire",
|
||||
on_delete=models.CASCADE
|
||||
)
|
||||
objects = QuestionnaireManager()
|
28
questionnaire/serializers.py
Normal file
28
questionnaire/serializers.py
Normal file
@ -0,0 +1,28 @@
|
||||
from rest_framework import serializers
|
||||
|
||||
from questionnaire.models import Questionnaire
|
||||
|
||||
class QuestionnaireSerializer(serializers.ModelSerializer):
|
||||
|
||||
class Meta:
|
||||
model = Questionnaire
|
||||
fields = (
|
||||
"id",
|
||||
"overall",
|
||||
"functionality",
|
||||
"look",
|
||||
"intuitive",
|
||||
"bugs",
|
||||
"tech",
|
||||
"potential",
|
||||
"worst",
|
||||
"desc",
|
||||
"fill_by"
|
||||
)
|
||||
|
||||
def create(self, validated_data):
|
||||
instance = Questionnaire.objects.create(
|
||||
**validated_data
|
||||
)
|
||||
return instance
|
||||
|
12
questionnaire/urls.py
Normal file
12
questionnaire/urls.py
Normal file
@ -0,0 +1,12 @@
|
||||
from django.urls import path
|
||||
from rest_framework.routers import DefaultRouter
|
||||
|
||||
from .views import questionnaire
|
||||
|
||||
router = DefaultRouter(trailing_slash=False)
|
||||
|
||||
urlpatterns = [
|
||||
path('questionnaire', questionnaire, name='questionnaire')
|
||||
]
|
||||
|
||||
urlpatterns += router.urls
|
22
questionnaire/views.py
Normal file
22
questionnaire/views.py
Normal file
@ -0,0 +1,22 @@
|
||||
from django.shortcuts import render, redirect
|
||||
from django.template import loader
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from questionnaire.models import Questionnaire
|
||||
|
||||
|
||||
@login_required
|
||||
def questionnaire(request):
|
||||
if request.POST:
|
||||
overall = request.GET.get("overall")
|
||||
functionality = request.GET.get("functionality")
|
||||
look = request.GET.get("look")
|
||||
intuitive = request.GET.get("intuitive")
|
||||
bugs = request.GET.get("bugs")
|
||||
tech = request.GET.get("tech")
|
||||
potential = request.GET.get("potential")
|
||||
worst = request.GET.get("worst")
|
||||
desc = request.GET.get("desc")
|
||||
Questionnaire.objects.create(overall=overall, functionality=functionality, look=look, intuitive=intuitive,
|
||||
bugs=bugs, tech=tech, potential=potential, worst=worst, desc=desc)
|
||||
return redirect('home')
|
||||
return render(request, 'questionnaire.html')
|
@ -38,6 +38,7 @@
|
||||
<a href="/category/Inne">Inne</a>
|
||||
<p>Konto</p>
|
||||
<a href="/users/account"><i class="fa-solid fa-gear"></i> Ustawienia</a>
|
||||
<a href="/questionnaire/questionnaire"><i class="fa-solid fa-file-pen"></i> Ankieta</a>
|
||||
<a href="{% url 'help' %}"><i class="fa-solid fa-circle-question"></i> Pomoc</a>
|
||||
<a href="/users/logout"><i class="fa-solid fa-right-from-bracket"></i> Wyloguj</a>
|
||||
</div>
|
||||
|
@ -1,6 +1,6 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Główna{% endblock %}
|
||||
{% block title %}Najtrudniejsze{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Najtrudniejsze testy:</h1>
|
||||
|
@ -1,6 +1,6 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Główna{% endblock %}
|
||||
{% block title %}Najpopularniejsze{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Najpopularniejsze testy:</h1>
|
||||
|
@ -1,10 +1,96 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
</head>
|
||||
<body>
|
||||
{% extends "base.html" %}
|
||||
|
||||
</body>
|
||||
</html>
|
||||
{% block title %}Ankieta{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="accountInfoContainer ">
|
||||
<h2>Ankieta oceniająca działanie aplikacji:</h2>
|
||||
<form method="post">
|
||||
<label for="overall">1. Jak ogólnie oceniasz aplikację?</label>
|
||||
<select name="overall" id="overall">
|
||||
<option value="1">Bardzo dobrze</option>
|
||||
<option value="2">Dobrze</option>
|
||||
<option value="3">Przeciętnie</option>
|
||||
<option value="4">Słabo</option>
|
||||
<option value="5">Bardzo słabo</option>
|
||||
</select>
|
||||
<br>
|
||||
<br>
|
||||
<label for="functionality">2. Jak oceniasz ilość dostępnych funkcjonalności?</label>
|
||||
<select name="functionality" id="functionality">
|
||||
<option value="1">Bardzo dużo</option>
|
||||
<option value="2">Sporo</option>
|
||||
<option value="3">Wystarczająco</option>
|
||||
<option value="4">Za mało</option>
|
||||
<option value="5">O wiele za mało</option>
|
||||
</select>
|
||||
<br>
|
||||
<br>
|
||||
<label for="look">3. Jak oceniasz wygląd aplikacji?</label>
|
||||
<select name="look" id="look">
|
||||
<option value="1">Bardzo ładny</option>
|
||||
<option value="2">Ładny</option>
|
||||
<option value="3">Przeciętny</option>
|
||||
<option value="4">Brzydki</option>
|
||||
<option value="5">Bardzo brzydki</option>
|
||||
</select>
|
||||
<br>
|
||||
<br>
|
||||
<label for="intuitive">4. Jak często było coś dla ciebie nieintuicyjne?</label>
|
||||
<select name="intuitive" id="intuitive">
|
||||
<option value="1">Nigdy</option>
|
||||
<option value="2">Bardzo rzadko</option>
|
||||
<option value="3">Rzadko</option>
|
||||
<option value="4">Często</option>
|
||||
<option value="5">Bardzo często</option>
|
||||
</select>
|
||||
<br>
|
||||
<br>
|
||||
<label for="bugs">5. Jak często napotkałeś jakiekolwiek błędy?</label>
|
||||
<select name="bugs" id="bugs">
|
||||
<option value="1">Nigdy</option>
|
||||
<option value="2">Bardzo rzadko</option>
|
||||
<option value="3">Rzadko</option>
|
||||
<option value="4">Często</option>
|
||||
<option value="5">Bardzo często</option>
|
||||
</select>
|
||||
<br>
|
||||
<br>
|
||||
<label for="tech">6. Jak cogólnie oceniasz stonę techniczną aplikacji?</label>
|
||||
<select name="tech" id="tech">
|
||||
<option value="1">Bardzo dobrze</option>
|
||||
<option value="2">Dobrze</option>
|
||||
<option value="3">Przeciętnie</option>
|
||||
<option value="4">Słsbo</option>
|
||||
<option value="5">Bardzo słabo</option>
|
||||
</select>
|
||||
<br>
|
||||
<br>
|
||||
<label for="potential">7. Jak duży potencjał widzisz?</label>
|
||||
<select name="potential" id="potential">
|
||||
<option value="1">Bardzo duży</option>
|
||||
<option value="2">Duży</option>
|
||||
<option value="3">Mały</option>
|
||||
<option value="4">Bardzo mały</option>
|
||||
<option value="5">Nie widzę żadnego</option>
|
||||
</select>
|
||||
<br>
|
||||
<br>
|
||||
<label for="worst">8. Który element według ciebie wypada najgorzej?</label>
|
||||
<select name="worst" id="worst">
|
||||
<option value="1">Wygląd</option>
|
||||
<option value="2">Przydatność</option>
|
||||
<option value="3">Intuicyjność</option>
|
||||
<option value="4">Strona techniczna</option>
|
||||
<option value="5">Żaden</option>
|
||||
</select>
|
||||
<br>
|
||||
<br>
|
||||
<label for="desc">9. Dodatkowe uwagi: </label>
|
||||
<input id="desc" type="text" name="desc">
|
||||
<br>
|
||||
<br>
|
||||
<input type="submit" value="Wyślij ankietę"><br><br>
|
||||
</form>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
Loading…
Reference in New Issue
Block a user