mirror of
https://github.com/vale981/vale981_fahrschule
synced 2025-03-04 09:21:41 -05:00
Final_1
This commit is contained in:
parent
00e768ff14
commit
e69263d952
27 changed files with 566 additions and 56 deletions
2
.idea/encodings.xml
generated
2
.idea/encodings.xml
generated
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false">
|
||||
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" defaultCharsetForPropertiesFiles="UTF-8">
|
||||
<file url="PROJECT" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
||||
|
|
BIN
db.sqlite3-journal
Normal file
BIN
db.sqlite3-journal
Normal file
Binary file not shown.
|
@ -38,6 +38,7 @@ INSTALLED_APPS = (
|
|||
'django.contrib.staticfiles',
|
||||
'fs_quiz',
|
||||
'django.contrib.staticfiles',
|
||||
'userprofile',
|
||||
)
|
||||
|
||||
MIDDLEWARE_CLASSES = (
|
||||
|
@ -60,7 +61,7 @@ WSGI_APPLICATION = 'fahrschule_vale981.wsgi.application'
|
|||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
||||
'NAME': 'fahrschule_3',
|
||||
'NAME': 'fs_final_1',
|
||||
'USER': 'postgres',
|
||||
'PASSWORD': 'valentin',
|
||||
'HOST': 'localhost'
|
||||
|
@ -89,3 +90,8 @@ STATIC_URL = '/static/'
|
|||
TEMPLATE_DIRS = (
|
||||
"/home/vale981/PycharmProjects/vale981_fahrschule/templates", # Change this to your own directory.
|
||||
)
|
||||
|
||||
MEDIA_ROOT = '/home/vale981/PycharmProjects/vale981_fahrschule/static/pics'
|
||||
|
||||
MEDIA_URL = '/media/'
|
||||
|
||||
|
|
|
@ -14,3 +14,11 @@ urlpatterns = patterns('',
|
|||
|
||||
url(r'^admin/', include(admin.site.urls)),
|
||||
)
|
||||
from django.conf import settings
|
||||
|
||||
if settings.DEBUG:
|
||||
# static files (images, css, javascript, etc.)
|
||||
urlpatterns += patterns('',
|
||||
(r'^media/(?P<path>.*)$', 'django.views.static.serve', {
|
||||
'document_root': settings.MEDIA_ROOT}))
|
||||
|
||||
|
|
27
fahrschule_vale981/views.py
Normal file
27
fahrschule_vale981/views.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
from django.shortcuts import render_to_response
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.contrib import auth
|
||||
from django.core.context_processors import csrf
|
||||
from django.contrib.auth import logout
|
||||
|
||||
def login(request):
|
||||
c = {}
|
||||
c.update(csrf(request))
|
||||
return render_to_response('login.html', c)
|
||||
|
||||
def auth_view(request):
|
||||
username = request.POST.get('username', '')
|
||||
password = request.POST.get('password', '')
|
||||
user = auth.authenticate(username=username, password=password)
|
||||
if user is not None:
|
||||
auth.login(request, user)
|
||||
return HttpResponseRedirect('/quiz/all/')
|
||||
else:
|
||||
return HttpResponseRedirect('/fehler/')
|
||||
|
||||
def error(request):
|
||||
return render_to_response('fehler.html')
|
||||
|
||||
def logout_view(request):
|
||||
logout(request)
|
||||
return HttpResponseRedirect('/login')
|
|
@ -4,4 +4,24 @@ from django.contrib import admin
|
|||
from fs_quiz.models import *
|
||||
admin.site.register(Frage)
|
||||
admin.site.register(Quiz)
|
||||
admin.site.register(Antwort)
|
||||
admin.site.register(Antwort)
|
||||
|
||||
from django.contrib.auth.admin import UserAdmin, GroupAdmin
|
||||
from django.contrib.auth.models import User, Group
|
||||
|
||||
from userprofile.models import UserQuizRel
|
||||
|
||||
# Define an inline admin descriptor for Employee model
|
||||
# which acts a bit like a singleton
|
||||
class UserQuizRelInline(admin.StackedInline):
|
||||
model = UserQuizRel
|
||||
can_delete = False
|
||||
verbose_name_plural = 'Quiz Verwaltung'
|
||||
|
||||
# Define a new User admin
|
||||
class UserAdmin(UserAdmin):
|
||||
inlines = (UserQuizRelInline, )
|
||||
|
||||
# Re-register UserAdmin
|
||||
admin.site.unregister(User)
|
||||
admin.site.register(User, UserAdmin)
|
||||
|
|
|
@ -1,14 +1,6 @@
|
|||
from django.db import models
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import datetime
|
||||
class Antwort(models.Model):
|
||||
|
||||
|
||||
|
@ -20,6 +12,8 @@ class Antwort(models.Model):
|
|||
|
||||
richtig = models.BooleanField(blank=True)
|
||||
|
||||
bild = models.ImageField(upload_to='pics/', blank=True, verbose_name="Antwort Bild")
|
||||
|
||||
def __unicode__(self):
|
||||
return self.content
|
||||
def __str__(self): # __unicode__ on Python 2
|
||||
|
@ -29,7 +23,8 @@ class Antwort(models.Model):
|
|||
|
||||
class Admin:
|
||||
pass
|
||||
|
||||
class Meta:
|
||||
verbose_name_plural='Antworten'
|
||||
|
||||
class Frage(models.Model):
|
||||
|
||||
|
@ -47,6 +42,8 @@ class Frage(models.Model):
|
|||
return self.content
|
||||
def __str__(self): # __unicode__ on Python 2
|
||||
return self.content
|
||||
class Meta:
|
||||
verbose_name_plural='Fragen'
|
||||
|
||||
class Quiz(models.Model) :
|
||||
fragen = models.ManyToManyField(Frage, blank=True, verbose_name="Fragen")
|
||||
|
@ -68,6 +65,8 @@ class Quiz(models.Model) :
|
|||
def __str__(self): # __unicode__ on Python 2
|
||||
return self.title
|
||||
|
||||
class Meta:
|
||||
verbose_name_plural='Quiz'
|
||||
|
||||
class Results(models.Model):
|
||||
quiz=models.ForeignKey(Quiz, blank=True, )
|
||||
|
@ -76,4 +75,9 @@ class Results(models.Model):
|
|||
richtig = models.BooleanField(blank=True)
|
||||
aw = models.ForeignKey(Antwort)
|
||||
choice = models.BooleanField(blank=True)
|
||||
datetime = models.DateTimeField(default=datetime.datetime.now())
|
||||
|
||||
class Meta:
|
||||
# sort by "the date" in descending order unless
|
||||
# overridden in the query with order_by()
|
||||
ordering = ['-datetime']
|
|
@ -7,5 +7,7 @@ urlpatterns = patterns('',
|
|||
url(r'^all/', 'fs_quiz.views.quizes', name='home'),
|
||||
url(r'^get/(?P<quiz_id>\d+)$', 'fs_quiz.views.quiz', name='home'),
|
||||
url(r'^check/', 'fs_quiz.views.check_view', name='check'),
|
||||
|
||||
url(r'^auswertung/', 'fs_quiz.views.auswertung_index', name='Auswertung'),
|
||||
url(r'^aw/get/(?P<user_id>\d+)$', 'fs_quiz.views.ausw_user', name='awuser'),
|
||||
url(r'^aw/get/(?P<user_id>\d+)/(?P<quiz_id>\d+)$', 'fs_quiz.views.ausw_user_quiz', name='awuserquiz'),
|
||||
)
|
||||
|
|
|
@ -8,7 +8,7 @@ from fs_quiz.models import *
|
|||
from fs_quiz.forms import *
|
||||
from fs_quiz.forms import Results
|
||||
from django.forms.models import modelformset_factory
|
||||
from django.contrib import auth
|
||||
from userprofile.models import UserQuizRel, ResultGroup
|
||||
|
||||
|
||||
def quizes(request):
|
||||
|
@ -17,11 +17,16 @@ def quizes(request):
|
|||
if Quiz.objects.count() == 0:
|
||||
height = 170
|
||||
height_menu = height
|
||||
if request.user.is_authenticated():
|
||||
user_quiz = UserQuizRel.objects.get(user=request.user)
|
||||
else:
|
||||
user_quiz = 0
|
||||
return render_to_response('quizzes.html',
|
||||
{'quizes': Quiz.objects.all(),
|
||||
'hg': height,
|
||||
'hg_m': height_menu,
|
||||
'user': request.user})
|
||||
'user': request.user._wrapped if hasattr(request.user,'_wrapped') else request.user,
|
||||
'user_quiz': user_quiz})
|
||||
|
||||
def quiz(request, quiz_id=1):
|
||||
cs = {}
|
||||
|
@ -48,13 +53,23 @@ def quiz(request, quiz_id=1):
|
|||
'count': count,
|
||||
'count_aw': count_aw})
|
||||
return render_to_response('quiz.html', cs)
|
||||
|
||||
import datetime
|
||||
def check_view(request):
|
||||
|
||||
user_id = request.POST.get('user_log', '')
|
||||
user_act = User.objects.get(id=user_id)
|
||||
|
||||
quiz_id = request.POST.get('quiz', '')
|
||||
|
||||
quiz = Quiz.objects.get(id=quiz_id)
|
||||
user_quiz = UserQuizRel.objects.get(user=user_act)
|
||||
user_quiz.quiz.add(quiz)
|
||||
user_quiz.allowed_quiz.remove(quiz)
|
||||
user_quiz.save()
|
||||
result_group=ResultGroup(user=user_act, quiz=quiz)
|
||||
result_group.res_time = datetime.datetime.now()
|
||||
result_group.save()
|
||||
|
||||
frage_list = Frage.objects.all()
|
||||
for frage_list in quiz.fragen.all():
|
||||
frage = frage_list
|
||||
|
@ -64,13 +79,40 @@ def check_view(request):
|
|||
aw_id = antwort.id
|
||||
richtig = antwort.richtig
|
||||
check = request.POST.get('aw_check'+str(aw_id), '')
|
||||
if bool(check) == bool(richtig):
|
||||
richtig_send = True
|
||||
if bool(richtig) == bool(check):
|
||||
richtig=True
|
||||
else:
|
||||
richtig_send = False
|
||||
richtig=False
|
||||
|
||||
res = Results(quiz=quiz, frage=frage, user=user_act, richtig=richtig_send, choice=check, aw=antwort)
|
||||
res = Results(quiz=quiz, frage=frage, user=user_act, richtig=richtig, choice=check, aw=antwort)
|
||||
res.save()
|
||||
result_group.results.add(res)
|
||||
result_group.save()
|
||||
return HttpResponseRedirect('/quiz/all/')
|
||||
|
||||
def auswertung_index(request):
|
||||
return render_to_response('auswertung.html', {'user': request.user,
|
||||
'users': User.objects.filter(groups__name = 'Schüler')})
|
||||
|
||||
def ausw_user(request, user_id=1):
|
||||
user = User.objects.get(id=user_id)
|
||||
return render_to_response('auswertung_user.html', {'user': user,
|
||||
'results': Results.objects.filter(user=user),
|
||||
'current_user': request.user,
|
||||
'results_all': Results.objects.all(),
|
||||
'fragen': Frage.objects.all(),
|
||||
'quiz': Quiz.objects.all(),
|
||||
'user_quiz': UserQuizRel.objects.get(user=user),
|
||||
})
|
||||
def ausw_user_quiz(request, user_id=1, quiz_id=1):
|
||||
user = User.objects.get(id=user_id)
|
||||
quiz = Quiz.objects.get(id=quiz_id)
|
||||
return render_to_response('auswertung_user_qzuiz.html', {'user': user,
|
||||
'current_user': request.user,
|
||||
'results': Results.objects.filter(user=user),
|
||||
'results_all': Results.objects.all(),
|
||||
'fragen': Frage.objects.all(),
|
||||
'quiz': quiz,
|
||||
'user_quiz': UserQuizRel.objects.get(user=user),
|
||||
'result_group': ResultGroup.objects.filter(user=user, quiz=quiz),
|
||||
})
|
||||
|
|
|
@ -15,7 +15,7 @@ left: 0;
|
|||
width: 150px; /*Width of frame div*/
|
||||
height: 100%;
|
||||
overflow: hidden; /*Disable scrollbars. Set to "scroll" to enable*/
|
||||
background: navy;
|
||||
background: #0404AF;
|
||||
color: white;
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ width: 100%;
|
|||
}
|
||||
|
||||
#men{
|
||||
font-family: 'Denk One', sans-serif;
|
||||
font-family: Arial, sans-serif;
|
||||
font-size: 24px;
|
||||
color: lightgrey;
|
||||
margin-left: 15px;
|
||||
|
@ -58,18 +58,237 @@ width: 100%;
|
|||
#men:visited {color: #ffffff;} /* visited link */
|
||||
#men:hover {color:white;} /* mouse over link */
|
||||
#main_link{
|
||||
font-family: "Denk One";
|
||||
font-family: Arial, sans-serif;
|
||||
color: dodgerblue;
|
||||
text-decoration: none;
|
||||
font-size: 20px;
|
||||
}
|
||||
h1{
|
||||
font-family: Arial, sans-serif;
|
||||
color: dodgerblue;
|
||||
text-decoration: none;
|
||||
font-size: 30px;
|
||||
}
|
||||
li{
|
||||
font-family: Arial, sans-serif;
|
||||
}
|
||||
|
||||
a{
|
||||
color: black;
|
||||
text-decoration: no-underline;
|
||||
|
||||
}
|
||||
#main_content{
|
||||
margin-top: -3.4%;
|
||||
}
|
||||
#frage{
|
||||
font-family: "Tauri";
|
||||
font-family: Arial, sans-serif;
|
||||
color: dodgerblue;
|
||||
text-decoration: underline;
|
||||
font-size: 20px;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
body {
|
||||
font-family: 'trebuchet MS', 'Lucida sans', Arial;
|
||||
font-size: 14px;
|
||||
color: #444;
|
||||
}
|
||||
|
||||
table {
|
||||
*border-collapse: collapse; /* IE7 and lower */
|
||||
border-spacing: 0;
|
||||
width: 60%;
|
||||
}
|
||||
|
||||
.bordered {
|
||||
border: solid #ccc 1px;
|
||||
-moz-border-radius: 6px;
|
||||
-webkit-border-radius: 6px;
|
||||
border-radius: 6px;
|
||||
-webkit-box-shadow: 0 1px 1px #ccc;
|
||||
-moz-box-shadow: 0 1px 1px #ccc;
|
||||
box-shadow: 0 1px 1px #ccc;
|
||||
}
|
||||
|
||||
.bordered td:hover {
|
||||
background: #fbf8e9;
|
||||
-o-transition: all 0.1s ease-in-out;
|
||||
-webkit-transition: all 0.1s ease-in-out;
|
||||
-moz-transition: all 0.1s ease-in-out;
|
||||
-ms-transition: all 0.1s ease-in-out;
|
||||
transition: all 0.1s ease-in-out;
|
||||
}
|
||||
|
||||
.bordered td, .bordered th {
|
||||
border-left: 1px solid #DEDEDE;
|
||||
border-top: 1px solid #DEDEDE;
|
||||
padding: 10px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.bordered th {
|
||||
background-color: #dce9f9;
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#ebf3fc), to(#dce9f9));
|
||||
background-image: -webkit-linear-gradient(top, #ebf3fc, #dce9f9);
|
||||
background-image: -moz-linear-gradient(top, #ebf3fc, #dce9f9);
|
||||
background-image: -ms-linear-gradient(top, #ebf3fc, #dce9f9);
|
||||
background-image: -o-linear-gradient(top, #ebf3fc, #dce9f9);
|
||||
background-image: linear-gradient(top, #ebf3fc, #dce9f9);
|
||||
-webkit-box-shadow: 0 1px 0 rgba(255,255,255,.8) inset;
|
||||
-moz-box-shadow:0 1px 0 rgba(255,255,255,.8) inset;
|
||||
box-shadow: 0 1px 0 rgba(255,255,255,.8) inset;
|
||||
border-top: none;
|
||||
text-shadow: 0 1px 0 rgba(255,255,255,.5);
|
||||
}
|
||||
|
||||
.bordered td:first-child, .bordered th:first-child {
|
||||
border-left: none;
|
||||
}
|
||||
|
||||
.bordered th:first-child {
|
||||
-moz-border-radius: 6px 0 0 0;
|
||||
-webkit-border-radius: 6px 0 0 0;
|
||||
border-radius: 6px 0 0 0;
|
||||
}
|
||||
|
||||
.bordered th:last-child {
|
||||
-moz-border-radius: 0 6px 0 0;
|
||||
-webkit-border-radius: 0 6px 0 0;
|
||||
border-radius: 0 6px 0 0;
|
||||
}
|
||||
|
||||
.bordered th:only-child{
|
||||
-moz-border-radius: 6px 6px 0 0;
|
||||
-webkit-border-radius: 6px 6px 0 0;
|
||||
border-radius: 6px 6px 0 0;
|
||||
}
|
||||
|
||||
.bordered tr:last-child td:first-child {
|
||||
-moz-border-radius: 0 0 0 6px;
|
||||
-webkit-border-radius: 0 0 0 6px;
|
||||
border-radius: 0 0 0 6px;
|
||||
}
|
||||
|
||||
.bordered tr:last-child td:last-child {
|
||||
-moz-border-radius: 0 0 6px 0;
|
||||
-webkit-border-radius: 0 0 6px 0;
|
||||
border-radius: 0 0 6px 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*----------------------*/
|
||||
|
||||
.zebra td, .zebra th {
|
||||
padding: 10px;
|
||||
border-bottom: 1px solid #f2f2f2;
|
||||
}
|
||||
|
||||
.zebra tbody tr:nth-child(even) {
|
||||
background: #f5f5f5;
|
||||
-webkit-box-shadow: 0 1px 0 rgba(255,255,255,.8) inset;
|
||||
-moz-box-shadow:0 1px 0 rgba(255,255,255,.8) inset;
|
||||
box-shadow: 0 1px 0 rgba(255,255,255,.8) inset;
|
||||
}
|
||||
|
||||
.zebra th {
|
||||
text-align: left;
|
||||
text-shadow: 0 1px 0 rgba(255,255,255,.5);
|
||||
border-bottom: 1px solid #ccc;
|
||||
background-color: #eee;
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#f5f5f5), to(#eee));
|
||||
background-image: -webkit-linear-gradient(top, #f5f5f5, #eee);
|
||||
background-image: -moz-linear-gradient(top, #f5f5f5, #eee);
|
||||
background-image: -ms-linear-gradient(top, #f5f5f5, #eee);
|
||||
background-image: -o-linear-gradient(top, #f5f5f5, #eee);
|
||||
background-image: linear-gradient(top, #f5f5f5, #eee);
|
||||
}
|
||||
|
||||
.zebra th:first-child {
|
||||
-moz-border-radius: 6px 0 0 0;
|
||||
-webkit-border-radius: 6px 0 0 0;
|
||||
border-radius: 6px 0 0 0;
|
||||
}
|
||||
|
||||
.zebra th:last-child {
|
||||
-moz-border-radius: 0 6px 0 0;
|
||||
-webkit-border-radius: 0 6px 0 0;
|
||||
border-radius: 0 6px 0 0;
|
||||
}
|
||||
|
||||
.zebra th:only-child{
|
||||
-moz-border-radius: 6px 6px 0 0;
|
||||
-webkit-border-radius: 6px 6px 0 0;
|
||||
border-radius: 6px 6px 0 0;
|
||||
}
|
||||
|
||||
.zebra tfoot td {
|
||||
border-bottom: 0;
|
||||
border-top: 1px solid #fff;
|
||||
background-color: #f1f1f1;
|
||||
}
|
||||
|
||||
.zebra tfoot td:first-child {
|
||||
-moz-border-radius: 0 0 0 6px;
|
||||
-webkit-border-radius: 0 0 0 6px;
|
||||
border-radius: 0 0 0 6px;
|
||||
}
|
||||
|
||||
.zebra tfoot td:last-child {
|
||||
-moz-border-radius: 0 0 6px 0;
|
||||
-webkit-border-radius: 0 0 6px 0;
|
||||
border-radius: 0 0 6px 0;
|
||||
}
|
||||
|
||||
.zebra tfoot td:only-child{
|
||||
-moz-border-radius: 0 0 6px 6px;
|
||||
-webkit-border-radius: 0 0 6px 6px
|
||||
border-radius: 0 0 6px 6px
|
||||
}
|
||||
|
||||
.button {
|
||||
-moz-box-shadow: 0px 0px 13px 4px #cae3fc;
|
||||
-webkit-box-shadow: 0px 0px 13px 4px #cae3fc;
|
||||
box-shadow: 0px 0px 5px 1px #cccccc;
|
||||
background-color:#DCE9F9;
|
||||
-webkit-border-top-left-radius:6px;
|
||||
-moz-border-radius-topleft:6px;
|
||||
border-top-left-radius:6px;
|
||||
-webkit-border-top-right-radius:6px;
|
||||
-moz-border-radius-topright:6px;
|
||||
border-top-right-radius:6px;
|
||||
-webkit-border-bottom-right-radius:6px;
|
||||
-moz-border-radius-bottomright:6px;
|
||||
border-bottom-right-radius:6px;
|
||||
-webkit-border-bottom-left-radius:6px;
|
||||
-moz-border-radius-bottomleft:6px;
|
||||
border-bottom-left-radius:6px;
|
||||
text-indent:0px;
|
||||
border:1px solid #cccccc;
|
||||
display:inline-block;
|
||||
color:#4197ee;
|
||||
font-family:Arial;
|
||||
font-size:23px;
|
||||
font-weight:bold;
|
||||
font-style:normal;
|
||||
height:50px;
|
||||
line-height:40px;
|
||||
width:100%;
|
||||
text-decoration:none;
|
||||
text-align:center;
|
||||
text-shadow:1px 1px 0px #cccccc;
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#EBF3FC), to(#DCE9F9));
|
||||
background-image: -webkit-linear-gradient(top, #EBF3FC, #DCE9F9);
|
||||
background-image: -moz-linear-gradient(top, #ebf3fc, #dce9f9);
|
||||
background-image: -ms-linear-gradient(top, #ebf3fc, #dce9f9);
|
||||
background-image: -o-linear-gradient(top, #ebf3fc, #dce9f9);
|
||||
background-image: linear-gradient(top, #ebf3fc, #dce9f9);
|
||||
}.button:hover {
|
||||
background-color:#4197ee;
|
||||
|
||||
}.button:active {
|
||||
position:relative;
|
||||
top:1px;
|
||||
}
|
||||
/* This button was generated using CSSButtonGenerator.com */
|
||||
|
|
4
static/jquery/jquery.js
vendored
Normal file
4
static/jquery/jquery.js
vendored
Normal file
File diff suppressed because one or more lines are too long
BIN
static/pics/pics/blackarch_wallpaper.jpg
Normal file
BIN
static/pics/pics/blackarch_wallpaper.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 59 KiB |
BIN
static/pics/pics/halteverbotsschild.jpg
Normal file
BIN
static/pics/pics/halteverbotsschild.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 116 KiB |
BIN
static/pics/pics/snapshot5.png
Normal file
BIN
static/pics/pics/snapshot5.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 62 KiB |
BIN
static/pics/pics/stop.png
Normal file
BIN
static/pics/pics/stop.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 19 KiB |
4
templates/admin/base_site.html
Normal file
4
templates/admin/base_site.html
Normal file
|
@ -0,0 +1,4 @@
|
|||
{% extends "admin/base.html" %}
|
||||
{% block branding %}
|
||||
<h1 id="site-name">Control Panel</h1>
|
||||
{% endblock %}
|
17
templates/auswertung.html
Normal file
17
templates/auswertung.html
Normal file
|
@ -0,0 +1,17 @@
|
|||
{% extends 'quizzes.html' %}
|
||||
|
||||
{% block main %}
|
||||
|
||||
{% if user.is_staff == False %}
|
||||
<h1>Kein Zutrit!</h1>
|
||||
{% else %}
|
||||
<h1>Übersicht über alle User der Gruppe Schüler:</h1>
|
||||
<ol>
|
||||
{% for users in users %}
|
||||
<li>
|
||||
<a href="/quiz/aw/get/{{ users.id }}">{{ users.get_full_name }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ol>
|
||||
{% endif %}
|
||||
{% endblock %}
|
16
templates/auswertung_user.html
Normal file
16
templates/auswertung_user.html
Normal file
|
@ -0,0 +1,16 @@
|
|||
{% extends 'quizzes.html' %}
|
||||
|
||||
{% block main %}
|
||||
{% if current_user.is_staff == False %}
|
||||
<h1>Kein Zutrit!</h1>
|
||||
{% else %}
|
||||
<h1>Übersicht für {{ user.get_full_name }}</h1>
|
||||
<ul>
|
||||
{% for quiz in user_quiz.quiz.all %}
|
||||
<li>
|
||||
<a href="/quiz/aw/get/{{ user.id }}/{{ quiz.id }}">{{ quiz.title }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% endblock %}
|
99
templates/auswertung_user_qzuiz.html
Normal file
99
templates/auswertung_user_qzuiz.html
Normal file
|
@ -0,0 +1,99 @@
|
|||
{% extends 'quizzes.html' %}
|
||||
|
||||
{% block main %}
|
||||
{% if current_user.is_staff == False %}
|
||||
<h1>Kein Zutrit!</h1>
|
||||
{% else %}
|
||||
{% for result_group in result_group %}
|
||||
<h1>{{ result_group.res_time }}</h1>
|
||||
|
||||
<table class="bordered" id="Result{{ result_group.id }}" border="0">
|
||||
|
||||
<tr>
|
||||
<th>Frage</th>
|
||||
<th>Antwort</th>
|
||||
<th>Angekreuzt</th>
|
||||
<th>Richtig</th>
|
||||
<th>Punkte</th>
|
||||
</tr>
|
||||
|
||||
{% for results in result_group.results.all %}
|
||||
{% for fragen in fragen %}
|
||||
|
||||
{% if fragen == results.frage %}
|
||||
|
||||
{% if results.richtig == True %}
|
||||
<tr style="background-color: MediumAquamarine">
|
||||
<td style="color: white;">{{ fragen.content }}</td>
|
||||
<td style="color: white;">{{ results.aw.content }}</td>
|
||||
{% if results.choice == True %}
|
||||
<td style="color: white;" align="center" >✓</td>
|
||||
{% else %}
|
||||
<td style="color: white;" align="center">X</td>
|
||||
{% endif %}
|
||||
<td style="color: white;">Richtig</td>
|
||||
<td class="addition" style="color: white;" align="center">1/1</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if results.richtig == False %}
|
||||
<tr style="background-color: #F08080">
|
||||
<td style="color: white;">{{ fragen.content }}</td>
|
||||
<td style="color: white;">{{ results.aw.content }}</td>
|
||||
{% if results.choice == True %}
|
||||
<td style="color: white;" align="center">✓</td>
|
||||
{% else %}
|
||||
<td style="color: white;" align="center">X</td>
|
||||
{% endif %}
|
||||
<td style="color: white;">Falsch</td>
|
||||
<td class="addition" style="color: white;" align="center">0/1</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% endfor %}
|
||||
|
||||
|
||||
{% endfor %}
|
||||
|
||||
<tr>
|
||||
|
||||
<th>Quiz:</th>
|
||||
<th>{{ quiz.title }}</th>
|
||||
<th>Benutzer:</th>
|
||||
<th>{{ user.get_full_name }}</th>
|
||||
|
||||
<th align="center"> <x id="sumall{{ result_group.id }}" align="center">SUMALL</x>/{{ result_group.results.count }}</th>
|
||||
</tr>
|
||||
</table>
|
||||
<script>
|
||||
var Points = 0.0;
|
||||
$('#Result{{ result_group.id }} td.addition').each(function(){
|
||||
Points += parseFloat($(this).text());
|
||||
});
|
||||
$("#sumall{{ result_group.id }}").text(Points);
|
||||
var rowCount = $('#myTable tr').length;
|
||||
</script>
|
||||
<script>
|
||||
var tableToExcel = (function() {
|
||||
var uri = 'data:application/vnd.ms-excel;base64,'
|
||||
, template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body><table>{table}</table></body></html>'
|
||||
, base64 = function(s) { return window.btoa(unescape(encodeURIComponent(s))) }
|
||||
, format = function(s, c) { return s.replace(/{(\w+)}/g, function(m, p) { return c[p]; }) }
|
||||
return function(table, name) {
|
||||
if (!table.nodeType) table = document.getElementById(table)
|
||||
var ctx = {worksheet: name || 'Worksheet', table: table.innerHTML}
|
||||
window.location.href = uri + base64(format(template, ctx))
|
||||
}
|
||||
})()
|
||||
</script>
|
||||
<br>
|
||||
<input type="button" download="{{ user.get_full_name }} | {{ result_group.res_time }} | Ergebnis.csv" onclick="tableToExcel('Result{{ result_group.id }}', '{{ user.get_full_name }} | {{ result_group.res_time }} | Ergebnis.csv')" value="Export to Excel">
|
||||
{% endfor %}
|
||||
|
||||
{% endif %}
|
||||
{% endblock %}
|
|
@ -21,30 +21,37 @@
|
|||
<br>
|
||||
<h1 id="main_link" style="text-align: center" align="center">Keine Fragen vorhanden!</h1>
|
||||
{% endif %}
|
||||
<ol>
|
||||
|
||||
<form action="/quiz/check/" name="quiz_form" method="post">{% csrf_token %}
|
||||
<input type="hidden" name="user_log" value="{{ user.id }}">
|
||||
<input type="hidden" name="quiz" value="{{ quiz.id }}">
|
||||
|
||||
{% for Frage in quiz.fragen.all %}
|
||||
<li><div id="frage">{{Frage.content}}</div></li>
|
||||
<input type="hidden" name="frage{{ Frage.id }}" value="{{ Frage.id }}">
|
||||
|
||||
{% for Frage in quiz.fragen.all %}
|
||||
<table class="bordered" style="width: 100%"><tr><th colspan="10"><div id="frage">{{Frage.content}}</div></th>
|
||||
<input type="hidden" name="frage{{ Frage.id }}" value="{{ Frage.id }}">
|
||||
</tr>
|
||||
<tr>
|
||||
{% for aw in Frage.antworten.all %}
|
||||
<input type="checkbox" name="aw_check{{ aw.id }}" id="aw_check">
|
||||
<label for="aw_check{{ aw.id }}">{{ aw.content }}</label>
|
||||
<td colspan="3">{% if aw.bild == "" %}{% else %}<img src="/media/{{ aw.bild }}" align="center" width="100"><br>{% endif %}
|
||||
<input align="center" type="checkbox" style="position: relative; bottom:-1px" class="css-checkbox" name="aw_check{{ aw.id }}" id="aw_check">
|
||||
<label for="aw_check{{ aw.id }}">{% if aw.bild == "" %}{{ aw.content }}{% else %}{% endif %}</label>
|
||||
</td>
|
||||
|
||||
<input type="hidden" name="antwort{{ Frage.id }}" value="{{ aw.id }}">
|
||||
|
||||
|
||||
<br>
|
||||
|
||||
|
||||
|
||||
{% endfor %}
|
||||
</tr></table><br>
|
||||
{% endfor %}
|
||||
<input type="submit" value="Abgeben"/>
|
||||
|
||||
<input type="submit" class="button" value="Abgeben"/>
|
||||
</form>
|
||||
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -2,4 +2,10 @@ a{
|
|||
font-family: Calibri;
|
||||
font-size: 20px;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
h1{
|
||||
font-family: Calibri;
|
||||
font-size: 20px;
|
||||
text-decoration: underline;
|
||||
}
|
|
@ -6,23 +6,12 @@
|
|||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<title>Fahrschul examiner...</title>
|
||||
<script type="text/javascript">
|
||||
WebFontConfig = {
|
||||
google: { families: [ 'Denk+One::latin', 'Tauri::latin', 'Vampiro+One::latin' ] }
|
||||
};
|
||||
(function() {
|
||||
var wf = document.createElement('script');
|
||||
wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
|
||||
'://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
|
||||
wf.type = 'text/javascript';
|
||||
wf.async = 'true';
|
||||
var s = document.getElementsByTagName('script')[0];
|
||||
s.parentNode.insertBefore(wf, s);
|
||||
})(); </script>
|
||||
|
||||
|
||||
|
||||
{% load staticfiles %}
|
||||
<link rel="stylesheet" type="text/css" href="{% static 'css/quizz.css' %}"/>
|
||||
<script type="text/javascript" src="{% static 'jquery/jquery.js' %}"></script>
|
||||
|
||||
</head>
|
||||
|
||||
|
@ -34,9 +23,14 @@
|
|||
<div class="men_div" style="margin-top: 15px;">
|
||||
<a id="men" href="/quiz/all">Übersicht</a>
|
||||
</div>
|
||||
{% if user.is_staff %}
|
||||
<div class="men_div">
|
||||
<a id="men" href="/admin">Admin</a>
|
||||
</div>
|
||||
<div class="men_div">
|
||||
<a id="men" href="/quiz/auswertung">Ergebnisse</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if user.is_authenticated %}
|
||||
<div class="men_div">
|
||||
<a href="/logout/" id="men"> Logout</a>
|
||||
|
@ -53,29 +47,35 @@
|
|||
|
||||
<div id="maincontent">
|
||||
<div class="innertube">
|
||||
|
||||
{% block content %}
|
||||
{% if user.is_authenticated %}
|
||||
{% block main %}
|
||||
<br>
|
||||
<br><br>
|
||||
|
||||
<div id="main_content">
|
||||
{% if quizes.count == 0 %}
|
||||
<h1 id="main_link" align="center">Keine Fragebogen vorhanden!</h1>
|
||||
{% elif user_quiz.allowed_quiz.count == 0 %}
|
||||
<h1 id="main_link" align="center">Keine Fragebogen vorhanden!</h1>
|
||||
{% endif %}
|
||||
<br>
|
||||
<table class="bordered" style="width: 100%">
|
||||
|
||||
<ol>
|
||||
|
||||
{% for quiz in quizes %}
|
||||
<li>
|
||||
<a id="main_link" href="/quiz/get/{{ quiz.id }}">{{ quiz.title }}</a>
|
||||
{% for quiz in user_quiz.allowed_quiz.all %}
|
||||
|
||||
<tr style="width: auto"><td><br><a id="main_link" href="/quiz/get/{{ quiz.id }}">{{ quiz.title }}</a>
|
||||
<br>
|
||||
{{ quiz.description }}<br>
|
||||
</li><br>
|
||||
<br></td></tr>
|
||||
{% endfor %}
|
||||
</ol>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% else %}
|
||||
<h1 id="main_link" align="center">Sie sind nicht angemeldet! Bitte <a href="/login">einloggen!</a> </h1>
|
||||
{% endif %}
|
||||
|
|
0
userprofile/__init__.py
Normal file
0
userprofile/__init__.py
Normal file
3
userprofile/admin.py
Normal file
3
userprofile/admin.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
20
userprofile/models.py
Normal file
20
userprofile/models.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
from django.db import models
|
||||
from django.contrib.auth.models import User
|
||||
from fs_quiz.models import Quiz, Results
|
||||
import datetime
|
||||
|
||||
def get_def():
|
||||
return Quiz.objects.all()
|
||||
|
||||
class UserQuizRel(models.Model):
|
||||
quiz=models.ManyToManyField(Quiz, blank=True, related_name='User', verbose_name='abgeschlossene Quizs')
|
||||
allowed_quiz=models.ManyToManyField(Quiz, blank=True, related_name='User-get', verbose_name='Erlaubte Quizs', default=get_def())
|
||||
user=models.OneToOneField(User)
|
||||
|
||||
class ResultGroup(models.Model):
|
||||
user = models.ForeignKey(User)
|
||||
results = models.ManyToManyField(Results, blank=True)
|
||||
res_time = models.DateTimeField(default=datetime.datetime.now())
|
||||
quiz = models.ForeignKey(Quiz)
|
||||
|
||||
|
3
userprofile/tests.py
Normal file
3
userprofile/tests.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
3
userprofile/views.py
Normal file
3
userprofile/views.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
from django.shortcuts import render
|
||||
|
||||
# Create your views here.
|
Loading…
Add table
Reference in a new issue