added indexes to support objects.filter and .order searches
parent
c7add25900
commit
2615e4e1dd
|
@ -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')]),
|
||||
),
|
||||
]
|
|
@ -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')]),
|
||||
),
|
||||
]
|
|
@ -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')]),
|
||||
),
|
||||
]
|
|
@ -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',)]),
|
||||
),
|
||||
]
|
|
@ -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',)]),
|
||||
),
|
||||
]
|
|
@ -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')]),
|
||||
),
|
||||
]
|
|
@ -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):
|
||||
|
@ -482,3 +497,9 @@ class Answer(models.Model):
|
|||
|
||||
runinfo.add_tags(tags_to_add)
|
||||
runinfo.save()
|
||||
|
||||
class Meta:
|
||||
index_together = [
|
||||
['subject', 'runid'],
|
||||
['subject', 'runid', 'id'],
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue