diff --git a/README.md b/README.md index 6b70009..54b6b09 100644 --- a/README.md +++ b/README.md @@ -5,4 +5,4 @@ requirements: - python - django - sqlite3 - +- tinymce \ No newline at end of file diff --git a/db.sqlite3 b/db.sqlite3 index 9c08e69..14df51f 100644 Binary files a/db.sqlite3 and b/db.sqlite3 differ diff --git a/tkupek_elearning/elearning/admin.py b/tkupek_elearning/elearning/admin.py index 5adec31..ea46478 100644 --- a/tkupek_elearning/elearning/admin.py +++ b/tkupek_elearning/elearning/admin.py @@ -1,6 +1,6 @@ from django.contrib import admin -from tkupek_elearning.elearning.models import Option, Setting, Question, UserAnswer, User, UserAnswerOptions +from tkupek_elearning.elearning.models import Option, Setting, Question, UserAnswer, User class OptionInline(admin.TabularInline): diff --git a/tkupek_elearning/elearning/migrations/0022_auto_20160305_1128.py b/tkupek_elearning/elearning/migrations/0022_auto_20160305_1128.py new file mode 100644 index 0000000..8729e43 --- /dev/null +++ b/tkupek_elearning/elearning/migrations/0022_auto_20160305_1128.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.1 on 2016-03-05 11:28 +from __future__ import unicode_literals + +from django.db import migrations, models +import tinymce.models +import tkupek_elearning.elearning.models + + +class Migration(migrations.Migration): + + dependencies = [ + ('elearning', '0021_setting_token'), + ] + + operations = [ + migrations.AlterField( + model_name='question', + name='explanation', + field=tinymce.models.HTMLField(null=True), + ), + migrations.AlterField( + model_name='user', + name='last_seen', + field=models.DateTimeField(blank=True, null=True), + ), + migrations.AlterField( + model_name='user', + name='token', + field=models.CharField(default=tkupek_elearning.elearning.models.gen_token, max_length=40, null=True, unique=True), + ), + ] diff --git a/tkupek_elearning/elearning/migrations/0023_auto_20160305_1158.py b/tkupek_elearning/elearning/migrations/0023_auto_20160305_1158.py new file mode 100644 index 0000000..157a16a --- /dev/null +++ b/tkupek_elearning/elearning/migrations/0023_auto_20160305_1158.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.1 on 2016-03-05 11:58 +from __future__ import unicode_literals + +from django.db import migrations +import tinymce.models + + +class Migration(migrations.Migration): + + dependencies = [ + ('elearning', '0022_auto_20160305_1128'), + ] + + operations = [ + migrations.AlterField( + model_name='question', + name='text', + field=tinymce.models.HTMLField(null=True), + ), + ] diff --git a/tkupek_elearning/elearning/models.py b/tkupek_elearning/elearning/models.py index 43c2eab..6a3469f 100644 --- a/tkupek_elearning/elearning/models.py +++ b/tkupek_elearning/elearning/models.py @@ -4,6 +4,7 @@ import hashlib import os from django.db import models +from tinymce.models import HTMLField def gen_token(): @@ -30,8 +31,8 @@ class Setting(models.Model): class Question(models.Model): id = models.AutoField(primary_key=True) title = models.CharField(max_length=100, null=True) - text = models.TextField(null=True) - explanation = models.TextField(null=True) + text = HTMLField(null=True) + explanation = HTMLField(null=True) def __unicode__(self): return self.title diff --git a/tkupek_elearning/elearning/templates/elearning.html b/tkupek_elearning/elearning/templates/elearning.html index 6802d0f..67b8913 100644 --- a/tkupek_elearning/elearning/templates/elearning.html +++ b/tkupek_elearning/elearning/templates/elearning.html @@ -35,7 +35,7 @@ {% for question, options in questions_options.items %}

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

-

{{ question.text }}

+

{{ question.text|safe }}

diff --git a/tkupek_elearning/settings.py b/tkupek_elearning/settings.py index a3cb137..381b514 100644 --- a/tkupek_elearning/settings.py +++ b/tkupek_elearning/settings.py @@ -37,7 +37,8 @@ INSTALLED_APPS = [ 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', - 'tkupek_elearning.elearning' + 'tkupek_elearning.elearning', + 'tinymce', ] MIDDLEWARE_CLASSES = [ diff --git a/tkupek_elearning/urls.py b/tkupek_elearning/urls.py index 646d63b..71391f1 100644 --- a/tkupek_elearning/urls.py +++ b/tkupek_elearning/urls.py @@ -13,7 +13,7 @@ Including another URLconf 1. Import the include() function: from django.conf.urls import url, include 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) """ -from django.conf.urls import url +from django.conf.urls import url, include from django.contrib import admin import tkupek_elearning.elearning.views @@ -23,5 +23,5 @@ urlpatterns = [ url(r'start', tkupek_elearning.elearning.views.start), url(r'api', tkupek_elearning.elearning.views.get_answer), url(r'statistic', tkupek_elearning.elearning.views.statistic), - + url(r'^tinymce/', include('tinymce.urls')), ]