Clean up unique on existing models
This commit is contained in:
parent
a44ac2fa81
commit
49eacdeef4
16 changed files with 141 additions and 12 deletions
|
@ -27,7 +27,7 @@ class Migration(migrations.Migration):
|
|||
name='Flaw',
|
||||
fields=[
|
||||
('id', models.AutoField(primary_key=True, serialize=False, auto_created=True, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=200)),
|
||||
('name', models.CharField(max_length=200, unique=True)),
|
||||
('description', models.CharField(blank=True, max_length=255)),
|
||||
('sort_order', models.IntegerField(blank=True, null=True)),
|
||||
],
|
||||
|
@ -84,6 +84,11 @@ class Migration(migrations.Migration):
|
|||
('treatment_type', models.ForeignKey(to='experiments.TreatmentType')),
|
||||
],
|
||||
),
|
||||
migrations.AlterUniqueTogether(
|
||||
name='treatment',
|
||||
unique_together=set([('treatment_type', 'container', 'study_location',
|
||||
'species', 'sex')]),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='TreatmentReplicate',
|
||||
fields=[
|
||||
|
@ -113,6 +118,11 @@ class Migration(migrations.Migration):
|
|||
('treatment_replicate', models.ForeignKey(to='experiments.TreatmentReplicate')),
|
||||
],
|
||||
),
|
||||
migrations.AlterUniqueTogether(
|
||||
name='alivedeadcount',
|
||||
unique_together=set([('treatment_replicate', 'status_date', 'status_time',
|
||||
'count_alive', 'count_dead')]),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='experiment',
|
||||
name='collections',
|
||||
|
|
|
@ -76,7 +76,8 @@ class Migration(migrations.Migration):
|
|||
'''):
|
||||
flaw = None
|
||||
if r[7]:
|
||||
flaw = Flaw.objects.create(name=r[10]).pk
|
||||
flaw, _ = Flaw.objects.get_or_create(name=r[10])
|
||||
flaw = flaw.pk
|
||||
form = TreatmentReplicateForm(dict(treatment=r[0], name=r[2],
|
||||
setup_date=r[13],
|
||||
setup_sample_size=r[5], mass_g=r[6],
|
||||
|
@ -101,7 +102,8 @@ class Migration(migrations.Migration):
|
|||
'''):
|
||||
flaw = None
|
||||
if r[6]:
|
||||
flaw = Flaw.objects.create(name=r[9]).pk
|
||||
flaw, _ = Flaw.objects.get_or_create(name=r[9])
|
||||
flaw = flaw.pk
|
||||
form = AliveDeadCountForm(dict(treatment_replicate=r[0],
|
||||
status_date=r[12],
|
||||
status_time=r[13].time() if r[13] else None,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue