diff --git a/db.sqlite3 b/db.sqlite3 index bd44820..713f141 100644 Binary files a/db.sqlite3 and b/db.sqlite3 differ diff --git a/tkupek_elearning/elearning/models.py b/tkupek_elearning/elearning/models.py index 5f50107..facd379 100644 --- a/tkupek_elearning/elearning/models.py +++ b/tkupek_elearning/elearning/models.py @@ -7,6 +7,7 @@ class Setting(models.Model): title = models.CharField(max_length=100, null=True) message = models.TextField(null=True) footer = models.TextField(null=True) + button_solution = models.CharField(max_length=100, null=True) active = models.BooleanField(unique=True, default=False) def __str__(self): diff --git a/tkupek_elearning/elearning/static/css/style.css b/tkupek_elearning/elearning/static/css/style.css new file mode 100644 index 0000000..63dd52f --- /dev/null +++ b/tkupek_elearning/elearning/static/css/style.css @@ -0,0 +1,35 @@ +body { + +} + +p { +text-align: justify; +} + +#showSolution { + display: block; +} + +p[id^="explanation_"] { + +} + +.show { + display: block; +} + +.hide { + display: none; +} + +.margin10 { + margin-top: 10px; +} + +.margin25 { + margin-top: 25px; +} + +.margin50 { + margin-top: 50px; +} diff --git a/tkupek_elearning/elearning/templates/images/favicon.ico b/tkupek_elearning/elearning/static/images/favicon.ico similarity index 100% rename from tkupek_elearning/elearning/templates/images/favicon.ico rename to tkupek_elearning/elearning/static/images/favicon.ico diff --git a/tkupek_elearning/elearning/static/js/elearning.js b/tkupek_elearning/elearning/static/js/elearning.js new file mode 100644 index 0000000..17e6d0b --- /dev/null +++ b/tkupek_elearning/elearning/static/js/elearning.js @@ -0,0 +1,9 @@ +function toggle_solution(id) +{ + element = document.getElementById("explanation_" + id); + if (element.className == "show") { + element.className = "hide"; + } else { + element.className = "show"; + } +} \ No newline at end of file diff --git a/tkupek_elearning/elearning/templates/css/style.css b/tkupek_elearning/elearning/templates/css/style.css deleted file mode 100644 index e69de29..0000000 diff --git a/tkupek_elearning/elearning/templates/index.html b/tkupek_elearning/elearning/templates/index.html index d2f8414..cef3ba5 100644 --- a/tkupek_elearning/elearning/templates/index.html +++ b/tkupek_elearning/elearning/templates/index.html @@ -4,9 +4,11 @@ - - - VCP Bayern - eLearning + {% load staticfiles %} + + + + {{ settings.title }} @@ -15,16 +17,28 @@

{{ settings.title }}

{{ settings.message }}


-
+
- {% for question in questions %} -

{{ question.id }}: {{ question.title }}

-

{{ question.text }}

-

{{ question.options }} : {{ question.answer }}

-

{{ question.explanation}}

+ {% for question, options in questions_options.items %} +

{{ question.id }}: {{ question.title }}

+

{{ question.text }}

+ +
+ {% for option in options %} + + + {% endfor %} + +
+ +

{{ question.explanation }}

+
{% endfor %} -
+

{{ settings.footer }} diff --git a/tkupek_elearning/elearning/views.py b/tkupek_elearning/elearning/views.py index 802b8cc..708f045 100644 --- a/tkupek_elearning/elearning/views.py +++ b/tkupek_elearning/elearning/views.py @@ -1,14 +1,19 @@ from django.shortcuts import render_to_response -from tkupek_elearning.elearning.models import Setting, Question +from tkupek_elearning.elearning.models import Setting, Question, Option -#import pdb; pdb.set_trace() +#import pdb def home(request): - questions = Question.objects.all() settings = Setting.objects.filter(active=1) - if(settings) : + if settings: settings = settings[0] - return render_to_response('index.html', {'settings': settings, 'questions': questions}) \ No newline at end of file + questions_options = {} + questions = Question.objects.all() + for question in questions: + options = Option.objects.filter(question=question.id) + questions_options[question] = options + + return render_to_response('index.html', {'settings': settings, 'questions_options': questions_options}) diff --git a/tkupek_elearning/settings.py b/tkupek_elearning/settings.py index 931e928..a3cb137 100644 --- a/tkupek_elearning/settings.py +++ b/tkupek_elearning/settings.py @@ -56,7 +56,7 @@ ROOT_URLCONF = 'tkupek_elearning.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': ["eLearning/templates"], + 'DIRS': ["elearning/templates"], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ diff --git a/tkupek_elearning/urls.py b/tkupek_elearning/urls.py index 253e5f8..ac08c56 100644 --- a/tkupek_elearning/urls.py +++ b/tkupek_elearning/urls.py @@ -20,5 +20,5 @@ import tkupek_elearning.elearning.views urlpatterns = [ url(r'^admin/', admin.site.urls), - url(r'', tkupek_elearning.elearning.views.home) + url(r'start', tkupek_elearning.elearning.views.home) ] \ No newline at end of file