Merge branch 'master' of github.com:draconicfae/ed-questionnaire

dj111py38
Jamie Campbell 2016-01-19 13:29:28 -06:00
commit 6698319b2c
10 changed files with 151 additions and 25 deletions

View File

@ -1,21 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('questionnaire', '0007_auto_20151207_1045'),
]
operations = [
migrations.CreateModel(
name='GlobalStyles',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('content', models.TextField()),
],
),
]

View File

@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('questionnaire', '0009_dbstylesheet_inclusion_tag'),
]
operations = [
migrations.AlterIndexTogether(
name='choice',
index_together=set([('value',)]),
),
]

View File

@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('questionnaire', '0010_index_choice_value'),
]
operations = [
migrations.AlterIndexTogether(
name='question',
index_together=set([('number', 'questionset')]),
),
]

View File

@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('questionnaire', '0011_index_on_question_mod_number_questionset'),
]
operations = [
migrations.AlterIndexTogether(
name='questionset',
index_together=set([('questionnaire', 'sortid')]),
),
]

View File

@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('questionnaire', '0012_questionset_questionnaire_and_sortid_index'),
]
operations = [
migrations.AlterIndexTogether(
name='answer',
index_together=set([('subject', 'runid', 'id'), ('subject', 'runid')]),
),
]

View File

@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('questionnaire', '0013__answer_index_subject_run_id'),
]
operations = [
migrations.AlterIndexTogether(
name='runinfo',
index_together=set([('random',)]),
),
]

View File

@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('questionnaire', '0014__runinfo_index_random'),
]
operations = [
migrations.AlterIndexTogether(
name='questionset',
index_together=set([('questionnaire', 'sortid'), ('sortid',)]),
),
]

View File

@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('questionnaire', '0015_questionnaire_index_sortid'),
]
operations = [
migrations.AlterIndexTogether(
name='subject',
index_together=set([('givenname', 'surname')]),
),
]

View File

@ -63,6 +63,11 @@ class Subject(models.Model):
def pending(self):
return RunInfo.objects.filter(subject=self).order_by('runid')
class Meta:
index_together = [
["givenname", "surname"],
]
class GlobalStyles(models.Model):
content = models.TextField()
@ -171,6 +176,10 @@ class QuestionSet(models.Model):
class Meta:
translate = ('text',)
index_together = [
["questionnaire", "sortid"],
["sortid",]
]
class RunInfo(models.Model):
@ -260,6 +269,9 @@ class RunInfo(models.Model):
class Meta:
verbose_name_plural = 'Run Info'
index_together = [
["random"],
]
class RunInfoHistory(models.Model):
@ -407,6 +419,9 @@ class Question(models.Model):
class Meta:
translate = ('text', 'extra', 'footer')
index_together = [
["number", "questionset"],
]
class Choice(models.Model):
@ -423,7 +438,10 @@ class Choice(models.Model):
class Meta:
translate = ('text',)
index_together = [
['value'],
]
class Answer(models.Model):
subject = models.ForeignKey(Subject, help_text = u'The user who supplied this answer')
@ -479,3 +497,9 @@ class Answer(models.Model):
runinfo.add_tags(tags_to_add)
runinfo.save()
class Meta:
index_together = [
['subject', 'runid'],
['subject', 'runid', 'id'],
]

View File

@ -716,8 +716,6 @@ def show_questionnaire(request, runinfo, errors={}):
if debug_questionnaire:
current_answers = Answer.objects.filter(subject=runinfo.subject, runid=runinfo.runid).order_by('id')
global_styles = GlobalStyles.objects.get(id=1)
r = r2r("questionnaire/questionset.html", request,
questionset=runinfo.questionset,
runinfo=runinfo,
@ -732,7 +730,6 @@ def show_questionnaire(request, runinfo, errors={}):
async_url=reverse('progress', args=[runinfo.random]),
prev_url=prev_url,
current_answers=current_answers,
global_styles=global_styles,
)
r['Cache-Control'] = 'no-cache'
r['Expires'] = "Thu, 24 Jan 1980 00:00:00 GMT"