diff --git a/db.sqlite3 b/db.sqlite3 index 7c942b4..c2c5383 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 ea46478..fe36c51 100644 --- a/tkupek_elearning/elearning/admin.py +++ b/tkupek_elearning/elearning/admin.py @@ -27,6 +27,11 @@ class UserAdmin(admin.ModelAdmin): return self.readonly_fields + ('token', 'last_seen') +class SettingAdmin(admin.ModelAdmin): + def get_readonly_fields(self, request, obj=None): + + return self.readonly_fields + ('statistic_token',) + admin.site.register(Question, QuestionAdmin) -admin.site.register(Setting), +admin.site.register(Setting, SettingAdmin), admin.site.register(User, UserAdmin) diff --git a/tkupek_elearning/elearning/migrations/0024_auto_20160305_1222.py b/tkupek_elearning/elearning/migrations/0024_auto_20160305_1222.py new file mode 100644 index 0000000..66d625d --- /dev/null +++ b/tkupek_elearning/elearning/migrations/0024_auto_20160305_1222.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.1 on 2016-03-05 12:22 +from __future__ import unicode_literals + +from django.db import migrations, models +import tkupek_elearning.elearning.models + + +class Migration(migrations.Migration): + + dependencies = [ + ('elearning', '0023_auto_20160305_1158'), + ] + + operations = [ + migrations.RemoveField( + model_name='setting', + name='token', + ), + migrations.AddField( + model_name='setting', + name='statistic_token', + field=models.CharField(default=tkupek_elearning.elearning.models.gen_token, max_length=40, null=True, unique=True), + ), + ] diff --git a/tkupek_elearning/elearning/models.py b/tkupek_elearning/elearning/models.py index 6a3469f..4e4f6f3 100644 --- a/tkupek_elearning/elearning/models.py +++ b/tkupek_elearning/elearning/models.py @@ -22,7 +22,7 @@ class Setting(models.Model): text_next = models.CharField(max_length=100, null=True) logo = models.CharField(max_length=256, null=False) active = models.BooleanField(unique=True, default=False) - token = models.CharField(max_length=40, null=True, default=gen_token) + statistic_token = models.CharField(max_length=40, null=True, default=gen_token, unique=True) def __unicode__(self): return self.title diff --git a/tkupek_elearning/elearning/templates/elearning.html b/tkupek_elearning/elearning/templates/elearning.html index 67b8913..7ca0743 100644 --- a/tkupek_elearning/elearning/templates/elearning.html +++ b/tkupek_elearning/elearning/templates/elearning.html @@ -24,7 +24,7 @@

{{ settings.title }}

-

{{ settings.message_welcome_user }}

+

{{ settings.message_welcome_user|safe }}

diff --git a/tkupek_elearning/elearning/views.py b/tkupek_elearning/elearning/views.py index a9757f4..f1ad9b9 100644 --- a/tkupek_elearning/elearning/views.py +++ b/tkupek_elearning/elearning/views.py @@ -8,7 +8,7 @@ import json from tkupek_elearning.elearning.models import Setting, Question, Option, UserAnswer, User, UserAnswerOptions -import pdb +#import pdb def get_progress(user): @@ -144,7 +144,7 @@ def statistic(request): return render_to_response('setting_null.html') try: - auth = Setting.objects.get(active=1, token=token) + auth = Setting.objects.get(active=1, statistic_token=token) except ObjectDoesNotExist: auth = None