diff --git a/fahrschule_vale981/urls.py b/fahrschule_vale981/urls.py index 40895e6..6f349e3 100644 --- a/fahrschule_vale981/urls.py +++ b/fahrschule_vale981/urls.py @@ -7,6 +7,7 @@ urlpatterns = patterns('', # Examples: (r'^quiz/', include('fs_quiz.urls')), # url(r'^blog/', include('blog.urls')), + (r'^/', 'fahrschule_vale981.views.login'), (r'^login/', 'fahrschule_vale981.views.login'), (r'^logout/', 'fahrschule_vale981.views.logout_view'), (r'^auth/', 'fahrschule_vale981.views.auth_view'), diff --git a/fahrschule_vale981/views.py b/fahrschule_vale981/views.py index dc983c9..27854aa 100644 --- a/fahrschule_vale981/views.py +++ b/fahrschule_vale981/views.py @@ -3,6 +3,11 @@ from django.http import HttpResponseRedirect from django.contrib import auth from django.core.context_processors import csrf from django.contrib.auth import logout +from django.contrib.auth.models import User +from django.contrib.auth.models import UserManager +from userprofile.models import UserQuizRel +from fs_quiz.models import Quiz + def login(request): c = {} @@ -10,11 +15,21 @@ def login(request): return render_to_response('login.html', c) def auth_view(request): - username = request.POST.get('username', '') - password = request.POST.get('password', '') + + firstname = request.POST.get('firstname', '') + lastname = request.POST.get('lastname', '') + password = 'standart' + username = firstname + lastname + User.objects.create_user(username=firstname+lastname, password='standart', first_name=firstname, last_name=lastname) + user = auth.authenticate(username=username, password=password) + if user is not None: auth.login(request, user) + uqr = UserQuizRel(user=request.user) + uqr.save() + uqr.allowed_quiz = Quiz.objects.all() + uqr.save() return HttpResponseRedirect('/quiz/all/') else: return HttpResponseRedirect('/fehler/') diff --git a/fs_quiz/views.py b/fs_quiz/views.py index 83b16be..f649d2b 100644 --- a/fs_quiz/views.py +++ b/fs_quiz/views.py @@ -92,7 +92,7 @@ def check_view(request): def auswertung_index(request): return render_to_response('auswertung.html', {'user': request.user, - 'users': User.objects.filter(groups__name = 'Schüler')}) + 'users': User.objects.all()}) def ausw_user(request, user_id=1): user = User.objects.get(id=user_id) diff --git a/static/css/quizz.css b/static/css/quizz.css index 5101ec6..c750cd7 100644 --- a/static/css/quizz.css +++ b/static/css/quizz.css @@ -8,37 +8,40 @@ max-height: 100%; } #framecontent{ -position: absolute; +position: relative; top: 0; bottom: 0; left: 0; -width: 150px; /*Width of frame div*/ -height: 100%; +width: 100%; /*Width of frame div*/ +height: 30px; overflow: hidden; /*Disable scrollbars. Set to "scroll" to enable*/ background: #0404AF; color: white; } #maincontent{ -position: fixed; +position: relative; top: 0; -left: 150px; /*Set left value to WidthOfFrameDiv*/ +overflow: hidden; + /*Set left value to WidthOfFrameDiv*/ right: 0; bottom: 0; -overflow: auto; background: #fff; } .innertube{ margin: 15px; /*Margins for inner DIV inside each DIV (to provide padding)*/ + } -.men_div:hover{ - - background-color: dodgerblue; +.men_div{ + display: inline; + position: relative; + top:3px } + * html body{ /*IE6 hack*/ padding: 0 0 0 200px; /*Set value to (0 0 0 WidthOfFrameDiv)*/ } @@ -50,9 +53,10 @@ width: 100%; #men{ font-family: Arial, sans-serif; - font-size: 24px; + font-size: 20px; color: lightgrey; margin-left: 15px; + text-align: left; } #men:link {color:white; text-decoration:none;} /* unvisited link */ #men:visited {color: #ffffff;} /* visited link */ @@ -62,6 +66,7 @@ width: 100%; color: dodgerblue; text-decoration: none; font-size: 20px; + text-align: center; } h1{ font-family: Arial, sans-serif; @@ -291,4 +296,9 @@ background-image: linear-gradient(top, #ebf3fc, #dce9f9); position:relative; top:1px; } -/* This button was generated using CSSButtonGenerator.com */ +.login{ + width: 300px; + height: 30px; + font-size: 20px; + text-align: center; +} diff --git a/templates/login.html b/templates/login.html index 9519bed..1fba59f 100644 --- a/templates/login.html +++ b/templates/login.html @@ -3,12 +3,14 @@ {% if form.errors %}

Benutzernahme oder Passwort falsch!

{% endif %} + {% csrf_token %} - - - - - + + + + + +
{% endblock %} \ No newline at end of file diff --git a/templates/quizz.css b/templates/quizz.css index d04be25..567c4f6 100644 --- a/templates/quizz.css +++ b/templates/quizz.css @@ -8,4 +8,5 @@ h1{ font-family: Calibri; font-size: 20px; text-decoration: underline; -} \ No newline at end of file +} + diff --git a/templates/quizzes.html b/templates/quizzes.html index f2c3b42..86a71b4 100644 --- a/templates/quizzes.html +++ b/templates/quizzes.html @@ -16,11 +16,11 @@ - +{% if user.is_staff == True %}
{% block menu %} -
+ {% if user.is_staff %} @@ -43,10 +43,10 @@ {% endblock %}
- +{% endif %}
-
+
{% block content %} {% if user.is_authenticated %} @@ -79,6 +79,8 @@ {% else %}

Sie sind nicht angemeldet! Bitte einloggen!

{% endif %} +
+ {% endblock %}
diff --git a/userprofile/models.py b/userprofile/models.py index 3f10cd2..b3723c9 100644 --- a/userprofile/models.py +++ b/userprofile/models.py @@ -8,7 +8,7 @@ def get_def(): 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()) + allowed_quiz=models.ManyToManyField(Quiz, blank=True, related_name='User-get', verbose_name='Erlaubte Quizs', default=Quiz.objects.all()) user=models.OneToOneField(User) class ResultGroup(models.Model):