diff --git a/smash/web/migrations/0150_auto_20200406_1144.py b/smash/web/migrations/0150_auto_20200406_1144.py new file mode 100644 index 0000000000000000000000000000000000000000..3f806628445a9ada2aeee60249ca7d56f24d5f82 --- /dev/null +++ b/smash/web/migrations/0150_auto_20200406_1144.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.5 on 2020-04-06 11:44 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('web', '0149_auto_20200406_0926'), + ] + + operations = [ + migrations.AlterIndexTogether( + name='provenance', + index_together=set([('modified_table', 'modified_table_id')]), + ), + ] diff --git a/smash/web/migrations/0151_auto_20200406_1207.py b/smash/web/migrations/0151_auto_20200406_1207.py new file mode 100644 index 0000000000000000000000000000000000000000..630fa020bc600198b67ec8b76aa5379222e6426a --- /dev/null +++ b/smash/web/migrations/0151_auto_20200406_1207.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.5 on 2020-04-06 12:07 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('web', '0150_auto_20200406_1144'), + ] + + operations = [ + migrations.AlterIndexTogether( + name='provenance', + index_together=set([('modified_table', 'modified_table_id', 'modification_date')]), + ), + ] diff --git a/smash/web/models/provenance.py b/smash/web/models/provenance.py index 0d9aeb7a7e3f2020d36c61254dd681dd02322522..79e1f665fa06dc4da8d67264f0b0924a2011c078 100644 --- a/smash/web/models/provenance.py +++ b/smash/web/models/provenance.py @@ -5,6 +5,7 @@ from django.db import models class Provenance(models.Model): class Meta: app_label = 'web' + index_together = ['modified_table', 'modified_table_id', 'modification_date'] modified_table = models.CharField(max_length=1024, diff --git a/smash/web/models/study_subject.py b/smash/web/models/study_subject.py index 80d2f8eac720a303f5e6919ef05d6801ddb6cbd9..0fe4b5c4129a7c3952aefca764dca658f3e2920f 100644 --- a/smash/web/models/study_subject.py +++ b/smash/web/models/study_subject.py @@ -17,7 +17,7 @@ class StudySubject(models.Model): @property def provenances(self): - return Provenance.objects.filter(modified_table=StudySubject._meta.db_table).filter(modified_table_id=self.id).order_by('-modification_date') + return Provenance.objects.filter(modified_table=StudySubject._meta.db_table, modified_table_id=self.id).order_by('-modification_date') def finish_all_visits(self): visits = Visit.objects.filter(subject=self, is_finished=False) diff --git a/smash/web/models/subject.py b/smash/web/models/subject.py index 22b45738320ebdce8119126c66753f1bd054f0cb..5a323cbe8a243f64182291dc01c657dd3a30847b 100644 --- a/smash/web/models/subject.py +++ b/smash/web/models/subject.py @@ -17,7 +17,7 @@ class Subject(models.Model): @property def provenances(self): - return Provenance.objects.filter(modified_table=Subject._meta.db_table).filter(modified_table_id=self.id).order_by('-modification_date') + return Provenance.objects.filter(modified_table=Subject._meta.db_table, modified_table_id=self.id).order_by('-modification_date') sex = models.CharField(max_length=1, choices=SEX_CHOICES,