parent
dbfe88610a
commit
70046b5104
14 changed files with 357 additions and 40 deletions
74
ccdb/experiments/migrations/0011_set_labels.py
Normal file
74
ccdb/experiments/migrations/0011_set_labels.py
Normal file
|
@ -0,0 +1,74 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('experiments', '0010_DATA_collections_experiments'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='alivedeadcount',
|
||||
name='flaw',
|
||||
field=models.ForeignKey(null=True, to='experiments.Flaw', related_name='alive_dead_counts', blank=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='alivedeadcount',
|
||||
name='treatment_replicate',
|
||||
field=models.ForeignKey(to='experiments.TreatmentReplicate', related_name='alive_dead_counts'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='experiment',
|
||||
name='flaw',
|
||||
field=models.ForeignKey(null=True, to='experiments.Flaw', related_name='experiments', blank=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='protocolattachment',
|
||||
name='experiment',
|
||||
field=models.ForeignKey(to='experiments.Experiment', related_name='protocols'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='treatment',
|
||||
name='container',
|
||||
field=models.ForeignKey(null=True, to='misc.Container', related_name='treatments', blank=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='treatment',
|
||||
name='flaw',
|
||||
field=models.ForeignKey(null=True, to='experiments.Flaw', related_name='treatments', blank=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='treatment',
|
||||
name='species',
|
||||
field=models.ForeignKey(to='species.Species', related_name='treatments'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='treatment',
|
||||
name='study_location',
|
||||
field=models.ForeignKey(to='locations.StudyLocation', related_name='treatments'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='treatment',
|
||||
name='treatment_type',
|
||||
field=models.ForeignKey(to='experiments.TreatmentType', related_name='treatments'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='treatmentreplicate',
|
||||
name='flaw',
|
||||
field=models.ForeignKey(null=True, to='experiments.Flaw', related_name='treatment_replicates', blank=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='treatmentreplicate',
|
||||
name='treatment',
|
||||
field=models.ForeignKey(to='experiments.Treatment', related_name='treatment_replicates'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='treatmenttype',
|
||||
name='experiment',
|
||||
field=models.ForeignKey(null=True, to='experiments.Experiment', related_name='treatment_types', blank=True),
|
||||
),
|
||||
]
|
|
@ -20,7 +20,7 @@ class Experiment(models.Model):
|
|||
name = models.CharField(max_length=150)
|
||||
code = models.CharField(max_length=10, blank=True)
|
||||
description = models.CharField(max_length=255, blank=True)
|
||||
flaw = models.ForeignKey(Flaw, blank=True, null=True)
|
||||
flaw = models.ForeignKey(Flaw, blank=True, null=True, related_name='experiments')
|
||||
sort_order = models.IntegerField(blank=True, null=True)
|
||||
slug = AutoSlugField(populate_from='name')
|
||||
collections = models.ManyToManyField('collections_ccdb.Collection')
|
||||
|
@ -34,7 +34,7 @@ class Experiment(models.Model):
|
|||
|
||||
|
||||
class ProtocolAttachment(models.Model):
|
||||
experiment = models.ForeignKey(Experiment)
|
||||
experiment = models.ForeignKey(Experiment, related_name='protocols')
|
||||
protocol = models.FileField(upload_to='experiments/protocols/%Y/%m/%d')
|
||||
|
||||
def __str__(self):
|
||||
|
@ -42,7 +42,8 @@ class ProtocolAttachment(models.Model):
|
|||
|
||||
|
||||
class TreatmentType(models.Model):
|
||||
experiment = models.ForeignKey(Experiment, blank=True, null=True)
|
||||
experiment = models.ForeignKey(Experiment, blank=True, null=True,
|
||||
related_name='treatment_types')
|
||||
name = models.CharField(max_length=200)
|
||||
code = models.CharField(max_length=25, blank=True)
|
||||
treatment_type = models.CharField(max_length=50, blank=True)
|
||||
|
@ -61,12 +62,14 @@ class TreatmentType(models.Model):
|
|||
|
||||
|
||||
class Treatment(models.Model):
|
||||
treatment_type = models.ForeignKey(TreatmentType)
|
||||
container = models.ForeignKey('misc.Container', blank=True, null=True)
|
||||
study_location = models.ForeignKey('locations.StudyLocation')
|
||||
species = models.ForeignKey('species.Species')
|
||||
treatment_type = models.ForeignKey(TreatmentType, related_name='treatments')
|
||||
container = models.ForeignKey('misc.Container', blank=True, null=True,
|
||||
related_name='treatments')
|
||||
study_location = models.ForeignKey('locations.StudyLocation',
|
||||
related_name='treatments')
|
||||
species = models.ForeignKey('species.Species', related_name='treatments')
|
||||
sex = models.CharField(max_length=25)
|
||||
flaw = models.ForeignKey(Flaw, blank=True, null=True)
|
||||
flaw = models.ForeignKey(Flaw, blank=True, null=True, related_name='treatments')
|
||||
display_name = models.CharField(max_length=255, editable=False)
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
|
@ -80,13 +83,13 @@ class Treatment(models.Model):
|
|||
|
||||
|
||||
class TreatmentReplicate(models.Model):
|
||||
treatment = models.ForeignKey(Treatment)
|
||||
treatment = models.ForeignKey(Treatment, related_name='treatment_replicates')
|
||||
name = models.CharField(max_length=50)
|
||||
setup_date = models.DateField(blank=True, null=True)
|
||||
setup_time = models.TimeField(blank=True, null=True)
|
||||
setup_sample_size = models.IntegerField(blank=True, null=True)
|
||||
mass_g = models.FloatField(blank=True, null=True)
|
||||
flaw = models.ForeignKey(Flaw, blank=True, null=True)
|
||||
flaw = models.ForeignKey(Flaw, blank=True, null=True, related_name='treatment_replicates')
|
||||
display_name = models.CharField(max_length=255, editable=False)
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
|
@ -103,12 +106,14 @@ class TreatmentReplicate(models.Model):
|
|||
|
||||
|
||||
class AliveDeadCount(models.Model):
|
||||
treatment_replicate = models.ForeignKey(TreatmentReplicate)
|
||||
treatment_replicate = models.ForeignKey(TreatmentReplicate,
|
||||
related_name='alive_dead_counts')
|
||||
status_date = models.DateField()
|
||||
status_time = models.TimeField(blank=True, null=True)
|
||||
count_alive = models.IntegerField(blank=True, null=True)
|
||||
count_dead = models.IntegerField(blank=True, null=True)
|
||||
flaw = models.ForeignKey(Flaw, blank=True, null=True)
|
||||
flaw = models.ForeignKey(Flaw, blank=True, null=True,
|
||||
related_name='alive_dead_counts')
|
||||
|
||||
def __str__(self):
|
||||
return "{}".format(self.status_date)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue