renamed statistic token, made it readonly
This commit is contained in:
parent
9b0708fdff
commit
c7e3d50038
6 changed files with 35 additions and 5 deletions
BIN
db.sqlite3
BIN
db.sqlite3
Binary file not shown.
|
@ -27,6 +27,11 @@ class UserAdmin(admin.ModelAdmin):
|
||||||
return self.readonly_fields + ('token', 'last_seen')
|
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(Question, QuestionAdmin)
|
||||||
admin.site.register(Setting),
|
admin.site.register(Setting, SettingAdmin),
|
||||||
admin.site.register(User, UserAdmin)
|
admin.site.register(User, UserAdmin)
|
||||||
|
|
|
@ -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),
|
||||||
|
),
|
||||||
|
]
|
|
@ -22,7 +22,7 @@ class Setting(models.Model):
|
||||||
text_next = models.CharField(max_length=100, null=True)
|
text_next = models.CharField(max_length=100, null=True)
|
||||||
logo = models.CharField(max_length=256, null=False)
|
logo = models.CharField(max_length=256, null=False)
|
||||||
active = models.BooleanField(unique=True, default=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):
|
def __unicode__(self):
|
||||||
return self.title
|
return self.title
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
<img src="{{ settings.logo }}" class="mainLogo">
|
<img src="{{ settings.logo }}" class="mainLogo">
|
||||||
<h1>{{ settings.title }}</h1>
|
<h1>{{ settings.title }}</h1>
|
||||||
<p>{{ settings.message_welcome_user }}</p>
|
<p>{{ settings.message_welcome_user|safe }}</p>
|
||||||
<div class="progress">
|
<div class="progress">
|
||||||
<div id="progressbar" class="progress-bar progress-bar-striped" role="progressbar" style="width: {{ progress }}%">
|
<div id="progressbar" class="progress-bar progress-bar-striped" role="progressbar" style="width: {{ progress }}%">
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -8,7 +8,7 @@ import json
|
||||||
from tkupek_elearning.elearning.models import Setting, Question, Option, UserAnswer, User, UserAnswerOptions
|
from tkupek_elearning.elearning.models import Setting, Question, Option, UserAnswer, User, UserAnswerOptions
|
||||||
|
|
||||||
|
|
||||||
import pdb
|
#import pdb
|
||||||
|
|
||||||
|
|
||||||
def get_progress(user):
|
def get_progress(user):
|
||||||
|
@ -144,7 +144,7 @@ def statistic(request):
|
||||||
return render_to_response('setting_null.html')
|
return render_to_response('setting_null.html')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
auth = Setting.objects.get(active=1, token=token)
|
auth = Setting.objects.get(active=1, statistic_token=token)
|
||||||
except ObjectDoesNotExist:
|
except ObjectDoesNotExist:
|
||||||
auth = None
|
auth = None
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue