Skip to content
Snippets Groups Projects
Commit fa7235ea authored by Carlos Vega's avatar Carlos Vega
Browse files

added indices to table

parent 794b4580
No related branches found
No related tags found
1 merge request!233Feature/provenance
Pipeline #24468 failed
# -*- 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')]),
),
]
# -*- 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')]),
),
]
......@@ -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,
......
......@@ -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)
......
......@@ -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,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment