Meta cleanup
This commit is contained in:
parent
e7c384ed5f
commit
1edb557f91
4 changed files with 54 additions and 2 deletions
|
@ -0,0 +1,18 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('collections_ccdb', '0003_collections_ordering'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name='adfgpermit',
|
||||||
|
options={'ordering': ['sort_order'], 'verbose_name': 'ADFG Permit'},
|
||||||
|
),
|
||||||
|
]
|
|
@ -55,6 +55,7 @@ class ADFGPermit(models.Model):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
ordering = ['sort_order']
|
ordering = ['sort_order']
|
||||||
|
verbose_name = 'ADFG Permit'
|
||||||
|
|
||||||
|
|
||||||
class Collection(models.Model):
|
class Collection(models.Model):
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('experiments', '0006_experiment_collections'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name='alivedeadcount',
|
||||||
|
options={'verbose_name': 'Alive-dead Count'},
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='treatmentreplicate',
|
||||||
|
name='display_name',
|
||||||
|
field=models.CharField(editable=False, max_length=255, default='x'),
|
||||||
|
preserve_default=False,
|
||||||
|
),
|
||||||
|
]
|
|
@ -81,10 +81,16 @@ class TreatmentReplicate(models.Model):
|
||||||
setup_sample_size = models.IntegerField(blank=True, null=True)
|
setup_sample_size = models.IntegerField(blank=True, null=True)
|
||||||
mass_g = models.FloatField(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)
|
||||||
|
display_name = models.CharField(max_length=255, editable=False)
|
||||||
|
|
||||||
|
def save(self, *args, **kwargs):
|
||||||
|
self.display_name = "{}_{}_{}_{}".format(self.treatment,
|
||||||
|
self.setup_date.date(), self.name,
|
||||||
|
self.setup_sample_size)
|
||||||
|
super(TreatmentReplicate, self).save(*args, **kwargs)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "{} {} {} {}".format(self.treatment, self.name,
|
return self.display_name
|
||||||
self.setup_date, self.setup_sample_size)
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
unique_together = ('treatment', 'name', 'setup_date', 'setup_time')
|
unique_together = ('treatment', 'name', 'setup_date', 'setup_time')
|
||||||
|
@ -100,3 +106,6 @@ class AliveDeadCount(models.Model):
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "{}".format(self.status_date)
|
return "{}".format(self.status_date)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
verbose_name = 'Alive-dead Count'
|
||||||
|
|
Loading…
Add table
Reference in a new issue