SQUASHING
This commit is contained in:
parent
8573b0326b
commit
a541a6f301
42 changed files with 588 additions and 1001 deletions
|
@ -1,26 +1,22 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
import autoslug.fields
|
import autoslug.fields
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('locations', '0002_remove_site_fk_dupes'),
|
('projects', '0002_DATA_initial'),
|
||||||
('projects', '0004_initial_grantreport'),
|
|
||||||
('processing', '0001_initial'),
|
('processing', '0001_initial'),
|
||||||
|
('locations', '0002_DATA_initial'),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='ADFGPermit',
|
name='ADFGPermit',
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.AutoField(primary_key=True, serialize=False, verbose_name='ID', auto_created=True)),
|
('id', models.AutoField(verbose_name='ID', serialize=False, primary_key=True, auto_created=True)),
|
||||||
('name', models.CharField(max_length=200)),
|
('name', models.CharField(max_length=200)),
|
||||||
('sort_order', models.IntegerField(null=True, blank=True)),
|
('sort_order', models.IntegerField(blank=True, null=True)),
|
||||||
('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name')),
|
('slug', autoslug.fields.AutoSlugField(populate_from='name', editable=False)),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'ordering': ['sort_order'],
|
'ordering': ['sort_order'],
|
||||||
|
@ -29,25 +25,25 @@ class Migration(migrations.Migration):
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='Collection',
|
name='Collection',
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.AutoField(primary_key=True, serialize=False, verbose_name='ID', auto_created=True)),
|
('id', models.AutoField(verbose_name='ID', serialize=False, primary_key=True, auto_created=True)),
|
||||||
('number_of_traps', models.IntegerField(null=True, blank=True)),
|
('number_of_traps', models.IntegerField(blank=True, null=True)),
|
||||||
('collection_start_date', models.DateField(null=True, blank=True)),
|
('collection_start_date', models.DateField(blank=True, null=True)),
|
||||||
('collection_start_time', models.TimeField(null=True, blank=True)),
|
('collection_start_time', models.TimeField(blank=True, null=True)),
|
||||||
('collection_end_date', models.DateField(null=True, blank=True)),
|
('collection_end_date', models.DateField(blank=True, null=True)),
|
||||||
('collection_end_time', models.TimeField(null=True, blank=True)),
|
('collection_end_time', models.TimeField(blank=True, null=True)),
|
||||||
('specimen_state', models.CharField(max_length=50, blank=True)),
|
('specimen_state', models.CharField(blank=True, max_length=50)),
|
||||||
('adfg_permit', models.ForeignKey(to='collections_ccdb.ADFGPermit', blank=True, null=True)),
|
('adfg_permit', models.ForeignKey(blank=True, null=True, to='collections_ccdb.ADFGPermit')),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='CollectionMethod',
|
name='CollectionMethod',
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.AutoField(primary_key=True, serialize=False, verbose_name='ID', auto_created=True)),
|
('id', models.AutoField(verbose_name='ID', serialize=False, primary_key=True, auto_created=True)),
|
||||||
('name', models.CharField(max_length=100)),
|
('name', models.CharField(max_length=100)),
|
||||||
('code', models.CharField(max_length=10, blank=True)),
|
('code', models.CharField(blank=True, max_length=10)),
|
||||||
('collection_method_class', models.CharField(max_length=50, blank=True)),
|
('collection_method_class', models.CharField(blank=True, max_length=50)),
|
||||||
('sort_order', models.IntegerField(null=True, blank=True)),
|
('sort_order', models.IntegerField(blank=True, null=True)),
|
||||||
('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name')),
|
('slug', autoslug.fields.AutoSlugField(populate_from='name', editable=False)),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'ordering': ['sort_order'],
|
'ordering': ['sort_order'],
|
||||||
|
@ -56,7 +52,7 @@ class Migration(migrations.Migration):
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='CollectionTrap',
|
name='CollectionTrap',
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.AutoField(primary_key=True, serialize=False, verbose_name='ID', auto_created=True)),
|
('id', models.AutoField(verbose_name='ID', serialize=False, primary_key=True, auto_created=True)),
|
||||||
('number_of_traps', models.IntegerField()),
|
('number_of_traps', models.IntegerField()),
|
||||||
('date_opened', models.DateField()),
|
('date_opened', models.DateField()),
|
||||||
('time_opened', models.TimeField()),
|
('time_opened', models.TimeField()),
|
||||||
|
@ -68,11 +64,11 @@ class Migration(migrations.Migration):
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='CollectionType',
|
name='CollectionType',
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.AutoField(primary_key=True, serialize=False, verbose_name='ID', auto_created=True)),
|
('id', models.AutoField(verbose_name='ID', serialize=False, primary_key=True, auto_created=True)),
|
||||||
('name', models.CharField(max_length=100)),
|
('name', models.CharField(max_length=100)),
|
||||||
('code', models.CharField(max_length=10, blank=True)),
|
('code', models.CharField(blank=True, max_length=10)),
|
||||||
('sort_order', models.IntegerField(null=True, blank=True)),
|
('sort_order', models.IntegerField(blank=True, null=True)),
|
||||||
('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name')),
|
('slug', autoslug.fields.AutoSlugField(populate_from='name', editable=False)),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'ordering': ['sort_order'],
|
'ordering': ['sort_order'],
|
||||||
|
@ -81,19 +77,19 @@ class Migration(migrations.Migration):
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='DatasheetAttachment',
|
name='DatasheetAttachment',
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.AutoField(primary_key=True, serialize=False, verbose_name='ID', auto_created=True)),
|
('id', models.AutoField(verbose_name='ID', serialize=False, primary_key=True, auto_created=True)),
|
||||||
('datasheet', models.FileField(verbose_name='Datasheet', upload_to='collections/datasheets/%Y/%m/%d')),
|
('datasheet', models.FileField(upload_to='collections/datasheets/%Y/%m/%d', verbose_name='Datasheet')),
|
||||||
('collection', models.ForeignKey(to='collections_ccdb.Collection')),
|
('collection', models.ForeignKey(to='collections_ccdb.Collection')),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='Flaw',
|
name='Flaw',
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.AutoField(primary_key=True, serialize=False, verbose_name='ID', auto_created=True)),
|
('id', models.AutoField(verbose_name='ID', serialize=False, primary_key=True, auto_created=True)),
|
||||||
('name', models.CharField(max_length=200)),
|
('name', models.CharField(max_length=200)),
|
||||||
('description', models.CharField(max_length=255, blank=True)),
|
('description', models.CharField(blank=True, max_length=255)),
|
||||||
('sort_order', models.IntegerField(null=True, blank=True)),
|
('sort_order', models.IntegerField(blank=True, null=True)),
|
||||||
('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name')),
|
('slug', autoslug.fields.AutoSlugField(populate_from='name', editable=False)),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'ordering': ['sort_order'],
|
'ordering': ['sort_order'],
|
||||||
|
@ -120,12 +116,12 @@ class Migration(migrations.Migration):
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='collection',
|
model_name='collection',
|
||||||
name='flaw',
|
name='flaw',
|
||||||
field=models.ForeignKey(to='collections_ccdb.Flaw', blank=True, null=True),
|
field=models.ForeignKey(blank=True, null=True, to='collections_ccdb.Flaw'),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='collection',
|
model_name='collection',
|
||||||
name='process_type',
|
name='process_type',
|
||||||
field=models.ForeignKey(to='processing.ProcessType', blank=True, null=True),
|
field=models.ForeignKey(blank=True, null=True, to='processing.ProcessType'),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='collection',
|
model_name='collection',
|
||||||
|
@ -135,12 +131,12 @@ class Migration(migrations.Migration):
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='collection',
|
model_name='collection',
|
||||||
name='reagent',
|
name='reagent',
|
||||||
field=models.ForeignKey(to='processing.Reagent', blank=True, null=True),
|
field=models.ForeignKey(blank=True, null=True, to='processing.Reagent'),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='collection',
|
model_name='collection',
|
||||||
name='storage_location',
|
name='storage_location',
|
||||||
field=models.ForeignKey(to='locations.StorageLocation', blank=True, null=True),
|
field=models.ForeignKey(blank=True, null=True, to='locations.StorageLocation'),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='collection',
|
model_name='collection',
|
||||||
|
@ -155,4 +151,73 @@ class Migration(migrations.Migration):
|
||||||
name='collection',
|
name='collection',
|
||||||
unique_together=set([('project', 'study_location', 'collection_type', 'collection_start_date', 'collection_end_date', 'collection_method')]),
|
unique_together=set([('project', 'study_location', 'collection_type', 'collection_start_date', 'collection_end_date', 'collection_method')]),
|
||||||
),
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='collection',
|
||||||
|
name='display_name',
|
||||||
|
field=models.CharField(editable=False, default='x', max_length=255),
|
||||||
|
preserve_default=False,
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name='collection',
|
||||||
|
options={'ordering': ['project', 'collection_end_date']},
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name='adfgpermit',
|
||||||
|
options={'ordering': ['sort_order'], 'verbose_name': 'ADFG Permit'},
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='collection',
|
||||||
|
name='adfg_permit',
|
||||||
|
field=models.ForeignKey(related_name='collections', blank=True, null=True, to='collections_ccdb.ADFGPermit'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='collection',
|
||||||
|
name='collection_method',
|
||||||
|
field=models.ForeignKey(related_name='collections', to='collections_ccdb.CollectionMethod'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='collection',
|
||||||
|
name='collection_type',
|
||||||
|
field=models.ForeignKey(related_name='collections', to='collections_ccdb.CollectionType'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='collection',
|
||||||
|
name='flaw',
|
||||||
|
field=models.ForeignKey(related_name='collections', blank=True, null=True, to='collections_ccdb.Flaw'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='collection',
|
||||||
|
name='process_type',
|
||||||
|
field=models.ForeignKey(related_name='collections', blank=True, null=True, to='processing.ProcessType'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='collection',
|
||||||
|
name='project',
|
||||||
|
field=models.ForeignKey(related_name='collections', to='projects.Project'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='collection',
|
||||||
|
name='reagent',
|
||||||
|
field=models.ForeignKey(related_name='collections', blank=True, null=True, to='processing.Reagent'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='collection',
|
||||||
|
name='storage_location',
|
||||||
|
field=models.ForeignKey(related_name='collections', blank=True, null=True, to='locations.StorageLocation'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='collection',
|
||||||
|
name='study_location',
|
||||||
|
field=models.ForeignKey(related_name='collections', to='locations.StudyLocation'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='collectiontrap',
|
||||||
|
name='collection',
|
||||||
|
field=models.ForeignKey(related_name='traps', to='collections_ccdb.Collection'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='datasheetattachment',
|
||||||
|
name='collection',
|
||||||
|
field=models.ForeignKey(related_name='datasheets', to='collections_ccdb.Collection'),
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -25,11 +25,15 @@ class Migration(migrations.Migration):
|
||||||
model.objects.all().delete()
|
model.objects.all().delete()
|
||||||
|
|
||||||
Project = apps.get_model('projects', 'Project')
|
Project = apps.get_model('projects', 'Project')
|
||||||
|
CollectionSpecies = apps.get_model('species', 'CollectionSpecies')
|
||||||
|
|
||||||
|
CollectionSpecies.objects.all().delete()
|
||||||
|
|
||||||
CollectionTypeForm = modelform_factory(CollectionType, fields='__all__')
|
CollectionTypeForm = modelform_factory(CollectionType, fields='__all__')
|
||||||
CollectionMethodForm = modelform_factory(CollectionMethod, fields='__all__')
|
CollectionMethodForm = modelform_factory(CollectionMethod, fields='__all__')
|
||||||
ADFGPermitForm = modelform_factory(ADFGPermit, fields='__all__')
|
ADFGPermitForm = modelform_factory(ADFGPermit, fields='__all__')
|
||||||
CollectionForm = modelform_factory(Collection, fields='__all__')
|
CollectionForm = modelform_factory(Collection, fields='__all__')
|
||||||
|
CollectionSpeciesForm = modelform_factory(CollectionSpecies, fields='__all__')
|
||||||
|
|
||||||
for r in c.execute('SELECT * FROM tbl_lu_collection_types;'):
|
for r in c.execute('SELECT * FROM tbl_lu_collection_types;'):
|
||||||
form = CollectionTypeForm(dict(name=r[1], code=r[2],
|
form = CollectionTypeForm(dict(name=r[1], code=r[2],
|
||||||
|
@ -85,6 +89,15 @@ class Migration(migrations.Migration):
|
||||||
else:
|
else:
|
||||||
print('collection', r[0:], form.errors.as_data())
|
print('collection', r[0:], form.errors.as_data())
|
||||||
|
|
||||||
|
for r in c.execute('SELECT * FROM tbl_hash_collection_species;'):
|
||||||
|
form = CollectionSpeciesForm(dict(collection=r[0], species=r[1], sex=r[2],
|
||||||
|
count=r[3], count_estimated=r[4]))
|
||||||
|
if form.is_valid():
|
||||||
|
# No PK in Andre's file
|
||||||
|
form.save()
|
||||||
|
else:
|
||||||
|
print('collection species', r[0:], form.errors.as_data())
|
||||||
|
|
||||||
def rollback(apps, schema_editor):
|
def rollback(apps, schema_editor):
|
||||||
CollectionType = apps.get_model('collections_ccdb', 'CollectionType')
|
CollectionType = apps.get_model('collections_ccdb', 'CollectionType')
|
||||||
CollectionMethod = apps.get_model('collections_ccdb', 'CollectionMethod')
|
CollectionMethod = apps.get_model('collections_ccdb', 'CollectionMethod')
|
||||||
|
@ -93,13 +106,15 @@ class Migration(migrations.Migration):
|
||||||
Collection = apps.get_model('collections_ccdb', 'Collection')
|
Collection = apps.get_model('collections_ccdb', 'Collection')
|
||||||
DatasheetAttachment = apps.get_model('collections_ccdb', 'DatasheetAttachment')
|
DatasheetAttachment = apps.get_model('collections_ccdb', 'DatasheetAttachment')
|
||||||
CollectionTrap = apps.get_model('collections_ccdb', 'CollectionTrap')
|
CollectionTrap = apps.get_model('collections_ccdb', 'CollectionTrap')
|
||||||
|
CollectionSpecies = apps.get_model('species', 'CollectionSpecies')
|
||||||
|
|
||||||
for model in [CollectionTrap, Collection, Flaw, DatasheetAttachment,
|
for model in [CollectionTrap, Collection, Flaw, DatasheetAttachment,
|
||||||
CollectionMethod, CollectionType, ADFGPermit]:
|
CollectionMethod, CollectionType, ADFGPermit, CollectionSpecies]:
|
||||||
model.objects.all().delete()
|
model.objects.all().delete()
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('collections_ccdb', '0004_collections_ordering'),
|
('collections_ccdb', '0001_initial'),
|
||||||
|
('processing', '0002_DATA_initial'),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
|
@ -1,20 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('collections_ccdb', '0001_initial'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AddField(
|
|
||||||
model_name='collection',
|
|
||||||
name='display_name',
|
|
||||||
field=models.CharField(max_length=255, editable=False, default='x'),
|
|
||||||
preserve_default=False,
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -1,18 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('collections_ccdb', '0002_collection_display_name'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AlterModelOptions(
|
|
||||||
name='collection',
|
|
||||||
options={'ordering': ['project', 'collection_end_date']},
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -1,18 +0,0 @@
|
||||||
# -*- 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'},
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -1,69 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('collections_ccdb', '0005_DATA_initial'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='collection',
|
|
||||||
name='adfg_permit',
|
|
||||||
field=models.ForeignKey(null=True, related_name='collections', to='collections_ccdb.ADFGPermit', blank=True),
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='collection',
|
|
||||||
name='collection_method',
|
|
||||||
field=models.ForeignKey(to='collections_ccdb.CollectionMethod', related_name='collections'),
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='collection',
|
|
||||||
name='collection_type',
|
|
||||||
field=models.ForeignKey(to='collections_ccdb.CollectionType', related_name='collections'),
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='collection',
|
|
||||||
name='flaw',
|
|
||||||
field=models.ForeignKey(null=True, related_name='collections', to='collections_ccdb.Flaw', blank=True),
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='collection',
|
|
||||||
name='process_type',
|
|
||||||
field=models.ForeignKey(null=True, related_name='collections', to='processing.ProcessType', blank=True),
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='collection',
|
|
||||||
name='project',
|
|
||||||
field=models.ForeignKey(to='projects.Project', related_name='collections'),
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='collection',
|
|
||||||
name='reagent',
|
|
||||||
field=models.ForeignKey(null=True, related_name='collections', to='processing.Reagent', blank=True),
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='collection',
|
|
||||||
name='storage_location',
|
|
||||||
field=models.ForeignKey(null=True, related_name='collections', to='locations.StorageLocation', blank=True),
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='collection',
|
|
||||||
name='study_location',
|
|
||||||
field=models.ForeignKey(to='locations.StudyLocation', related_name='collections'),
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='collectiontrap',
|
|
||||||
name='collection',
|
|
||||||
field=models.ForeignKey(to='collections_ccdb.Collection', related_name='traps'),
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='datasheetattachment',
|
|
||||||
name='collection',
|
|
||||||
field=models.ForeignKey(to='collections_ccdb.Collection', related_name='datasheets'),
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -1,24 +1,24 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
import autoslug.fields
|
import autoslug.fields
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
('misc', '0001_initial'),
|
||||||
|
('locations', '0001_initial'),
|
||||||
|
('collections_ccdb', '0001_initial'),
|
||||||
|
('species', '0001_initial'),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='Experiment',
|
name='Experiment',
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.AutoField(auto_created=True, serialize=False, verbose_name='ID', primary_key=True)),
|
('id', models.AutoField(primary_key=True, serialize=False, auto_created=True, verbose_name='ID')),
|
||||||
('name', models.CharField(max_length=150)),
|
('name', models.CharField(max_length=150)),
|
||||||
('code', models.CharField(max_length=10, blank=True)),
|
('code', models.CharField(blank=True, max_length=10)),
|
||||||
('description', models.CharField(max_length=255, blank=True)),
|
('description', models.CharField(blank=True, max_length=255)),
|
||||||
('sort_order', models.IntegerField(null=True, blank=True)),
|
('sort_order', models.IntegerField(blank=True, null=True)),
|
||||||
('slug', autoslug.fields.AutoSlugField(populate_from='name', editable=False)),
|
('slug', autoslug.fields.AutoSlugField(populate_from='name', editable=False)),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
|
@ -28,10 +28,10 @@ class Migration(migrations.Migration):
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='Flaw',
|
name='Flaw',
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.AutoField(auto_created=True, serialize=False, verbose_name='ID', primary_key=True)),
|
('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)),
|
||||||
('description', models.CharField(max_length=255, blank=True)),
|
('description', models.CharField(blank=True, max_length=255)),
|
||||||
('sort_order', models.IntegerField(null=True, blank=True)),
|
('sort_order', models.IntegerField(blank=True, null=True)),
|
||||||
('slug', autoslug.fields.AutoSlugField(populate_from='name', editable=False)),
|
('slug', autoslug.fields.AutoSlugField(populate_from='name', editable=False)),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
|
@ -41,7 +41,7 @@ class Migration(migrations.Migration):
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='ProtocolAttachment',
|
name='ProtocolAttachment',
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.AutoField(auto_created=True, serialize=False, verbose_name='ID', primary_key=True)),
|
('id', models.AutoField(primary_key=True, serialize=False, auto_created=True, verbose_name='ID')),
|
||||||
('protocol', models.FileField(upload_to='experiments/protocols/%Y/%m/%d')),
|
('protocol', models.FileField(upload_to='experiments/protocols/%Y/%m/%d')),
|
||||||
('experiment', models.ForeignKey(to='experiments.Experiment')),
|
('experiment', models.ForeignKey(to='experiments.Experiment')),
|
||||||
],
|
],
|
||||||
|
@ -55,4 +55,147 @@ class Migration(migrations.Migration):
|
||||||
name='experiment',
|
name='experiment',
|
||||||
unique_together=set([('name', 'code')]),
|
unique_together=set([('name', 'code')]),
|
||||||
),
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='TreatmentType',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(primary_key=True, serialize=False, auto_created=True, verbose_name='ID')),
|
||||||
|
('name', models.CharField(max_length=200)),
|
||||||
|
('code', models.CharField(blank=True, max_length=25)),
|
||||||
|
('treatment_type', models.CharField(blank=True, max_length=50)),
|
||||||
|
('placement', models.CharField(blank=True, max_length=25)),
|
||||||
|
('description', models.CharField(blank=True, max_length=255)),
|
||||||
|
('sort_order', models.IntegerField(blank=True, null=True)),
|
||||||
|
('slug', autoslug.fields.AutoSlugField(populate_from='name', editable=False)),
|
||||||
|
('experiment', models.ForeignKey(to='experiments.Experiment', null=True, blank=True)),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'ordering': ['sort_order'],
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.AlterUniqueTogether(
|
||||||
|
name='treatmenttype',
|
||||||
|
unique_together=set([('experiment', 'name')]),
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Treatment',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(primary_key=True, serialize=False, auto_created=True, verbose_name='ID')),
|
||||||
|
('sex', models.CharField(max_length=25)),
|
||||||
|
('container', models.ForeignKey(to='misc.Container', null=True, blank=True)),
|
||||||
|
('flaw', models.ForeignKey(to='experiments.Flaw', null=True, blank=True)),
|
||||||
|
('species', models.ForeignKey(to='species.Species')),
|
||||||
|
('study_location', models.ForeignKey(to='locations.StudyLocation')),
|
||||||
|
('treatment_type', models.ForeignKey(to='experiments.TreatmentType')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='TreatmentReplicate',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(primary_key=True, serialize=False, auto_created=True, verbose_name='ID')),
|
||||||
|
('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(to='experiments.Flaw', null=True, blank=True)),
|
||||||
|
('treatment', models.ForeignKey(to='experiments.Treatment')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.AlterUniqueTogether(
|
||||||
|
name='treatmentreplicate',
|
||||||
|
unique_together=set([('treatment', 'name', 'setup_date', 'setup_time')]),
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='AliveDeadCount',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(primary_key=True, serialize=False, auto_created=True, verbose_name='ID')),
|
||||||
|
('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(to='experiments.Flaw', null=True, blank=True)),
|
||||||
|
('treatment_replicate', models.ForeignKey(to='experiments.TreatmentReplicate')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='experiment',
|
||||||
|
name='collections',
|
||||||
|
field=models.ManyToManyField(to='collections_ccdb.Collection'),
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name='alivedeadcount',
|
||||||
|
options={'verbose_name': 'Alive-dead Count'},
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='treatmentreplicate',
|
||||||
|
name='display_name',
|
||||||
|
field=models.CharField(default='x', max_length=255, editable=False),
|
||||||
|
preserve_default=False,
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='treatment',
|
||||||
|
name='display_name',
|
||||||
|
field=models.CharField(default='x', max_length=255, editable=False),
|
||||||
|
preserve_default=False,
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='alivedeadcount',
|
||||||
|
name='flaw',
|
||||||
|
field=models.ForeignKey(related_name='alive_dead_counts', to='experiments.Flaw', null=True, blank=True),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='alivedeadcount',
|
||||||
|
name='treatment_replicate',
|
||||||
|
field=models.ForeignKey(related_name='alive_dead_counts', to='experiments.TreatmentReplicate'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='experiment',
|
||||||
|
name='flaw',
|
||||||
|
field=models.ForeignKey(related_name='experiments', to='experiments.Flaw', null=True, blank=True),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='protocolattachment',
|
||||||
|
name='experiment',
|
||||||
|
field=models.ForeignKey(related_name='protocols', to='experiments.Experiment'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='treatment',
|
||||||
|
name='container',
|
||||||
|
field=models.ForeignKey(related_name='treatments', to='misc.Container', null=True, blank=True),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='treatment',
|
||||||
|
name='flaw',
|
||||||
|
field=models.ForeignKey(related_name='treatments', to='experiments.Flaw', null=True, blank=True),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='treatment',
|
||||||
|
name='species',
|
||||||
|
field=models.ForeignKey(related_name='treatments', to='species.Species'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='treatment',
|
||||||
|
name='study_location',
|
||||||
|
field=models.ForeignKey(related_name='treatments', to='locations.StudyLocation'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='treatment',
|
||||||
|
name='treatment_type',
|
||||||
|
field=models.ForeignKey(related_name='treatments', to='experiments.TreatmentType'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='treatmentreplicate',
|
||||||
|
name='flaw',
|
||||||
|
field=models.ForeignKey(related_name='treatment_replicates', to='experiments.Flaw', null=True, blank=True),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='treatmentreplicate',
|
||||||
|
name='treatment',
|
||||||
|
field=models.ForeignKey(related_name='treatment_replicates', to='experiments.Treatment'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='treatmenttype',
|
||||||
|
name='experiment',
|
||||||
|
field=models.ForeignKey(related_name='treatment_types', to='experiments.Experiment', null=True, blank=True),
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -23,6 +23,10 @@ class Migration(migrations.Migration):
|
||||||
Experiment, Flaw]:
|
Experiment, Flaw]:
|
||||||
model.objects.all().delete()
|
model.objects.all().delete()
|
||||||
|
|
||||||
|
Collection = apps.get_model('collections_ccdb', 'Collection')
|
||||||
|
StudyLocation = apps.get_model('locations', 'StudyLocation')
|
||||||
|
Species = apps.get_model('species', 'Species')
|
||||||
|
|
||||||
ExperimentForm = modelform_factory(Experiment, exclude=('collections',))
|
ExperimentForm = modelform_factory(Experiment, exclude=('collections',))
|
||||||
TreatmentTypeForm = modelform_factory(TreatmentType, fields='__all__')
|
TreatmentTypeForm = modelform_factory(TreatmentType, fields='__all__')
|
||||||
TreatmentForm = modelform_factory(Treatment, fields='__all__')
|
TreatmentForm = modelform_factory(Treatment, fields='__all__')
|
||||||
|
@ -50,7 +54,12 @@ class Migration(migrations.Migration):
|
||||||
form = TreatmentForm(dict(treatment_type=r[1], container=r[2],
|
form = TreatmentForm(dict(treatment_type=r[1], container=r[2],
|
||||||
study_location=r[3], species=r[4], sex=r[5]))
|
study_location=r[3], species=r[4], sex=r[5]))
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
Treatment.objects.create(id=r[0], **form.cleaned_data)
|
treatment_type = TreatmentType.objects.get(id=r[1])
|
||||||
|
study_location = StudyLocation.objects.get(id=r[3])
|
||||||
|
species = Species.objects.get(id=r[4])
|
||||||
|
d = "{}_{}_{}_{}".format(treatment_type, study_location,
|
||||||
|
species, form.cleaned_data['sex'])
|
||||||
|
Treatment.objects.create(id=r[0], display_name=d, **form.cleaned_data)
|
||||||
else:
|
else:
|
||||||
print('treatment', r[0:], form.errors.as_data())
|
print('treatment', r[0:], form.errors.as_data())
|
||||||
|
|
||||||
|
@ -91,6 +100,17 @@ class Migration(migrations.Migration):
|
||||||
else:
|
else:
|
||||||
print('alive-dead count', r[0:], form.errors.as_data())
|
print('alive-dead count', r[0:], form.errors.as_data())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for experiment in Experiment.objects.all():
|
||||||
|
experiment.collections.all().delete()
|
||||||
|
|
||||||
|
for r in c.execute('SELECT * FROM tbl_hash_collection_experiments;'):
|
||||||
|
c = Collection.objects.get(id=r[0])
|
||||||
|
e = Experiment.objects.get(id=r[1])
|
||||||
|
e.collections.add(c)
|
||||||
|
e.save()
|
||||||
|
|
||||||
def rollback(apps, schema_editor):
|
def rollback(apps, schema_editor):
|
||||||
Flaw = apps.get_model('experiments', 'Flaw')
|
Flaw = apps.get_model('experiments', 'Flaw')
|
||||||
Experiment = apps.get_model('experiments', 'Experiment')
|
Experiment = apps.get_model('experiments', 'Experiment')
|
||||||
|
@ -103,9 +123,13 @@ class Migration(migrations.Migration):
|
||||||
Experiment, Flaw]:
|
Experiment, Flaw]:
|
||||||
model.objects.all().delete()
|
model.objects.all().delete()
|
||||||
|
|
||||||
|
for experiment in Experiment.objects.all():
|
||||||
|
experiment.collections.all().delete()
|
||||||
|
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('experiments', '0008_treatment_display_name'),
|
('experiments', '0001_initial'),
|
||||||
('collections_ccdb', '0005_DATA_initial'),
|
('collections_ccdb', '0002_DATA_initial'),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
|
@ -1,36 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
import autoslug.fields
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('experiments', '0001_initial'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.CreateModel(
|
|
||||||
name='TreatmentType',
|
|
||||||
fields=[
|
|
||||||
('id', models.AutoField(primary_key=True, auto_created=True, verbose_name='ID', serialize=False)),
|
|
||||||
('name', models.CharField(max_length=200)),
|
|
||||||
('code', models.CharField(max_length=25, blank=True)),
|
|
||||||
('treatment_type', models.CharField(max_length=50, blank=True)),
|
|
||||||
('placement', models.CharField(max_length=25, blank=True)),
|
|
||||||
('description', models.CharField(max_length=255, blank=True)),
|
|
||||||
('sort_order', models.IntegerField(null=True, blank=True)),
|
|
||||||
('slug', autoslug.fields.AutoSlugField(populate_from='name', editable=False)),
|
|
||||||
('experiment', models.ForeignKey(null=True, blank=True, to='experiments.Experiment')),
|
|
||||||
],
|
|
||||||
options={
|
|
||||||
'ordering': ['sort_order'],
|
|
||||||
},
|
|
||||||
),
|
|
||||||
migrations.AlterUniqueTogether(
|
|
||||||
name='treatmenttype',
|
|
||||||
unique_together=set([('experiment', 'name')]),
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -1,29 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('misc', '0001_initial'),
|
|
||||||
('species', '0003_collectionspecies'),
|
|
||||||
('locations', '0002_remove_site_fk_dupes'),
|
|
||||||
('experiments', '0002_treatment_type'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.CreateModel(
|
|
||||||
name='Treatment',
|
|
||||||
fields=[
|
|
||||||
('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)),
|
|
||||||
('sex', models.CharField(max_length=25)),
|
|
||||||
('container', models.ForeignKey(blank=True, null=True, to='misc.Container')),
|
|
||||||
('flaw', models.ForeignKey(blank=True, null=True, to='experiments.Flaw')),
|
|
||||||
('species', models.ForeignKey(to='species.Species')),
|
|
||||||
('study_location', models.ForeignKey(to='locations.StudyLocation')),
|
|
||||||
('treatment_type', models.ForeignKey(to='experiments.TreatmentType')),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -1,31 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('experiments', '0003_treatment'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.CreateModel(
|
|
||||||
name='TreatmentReplicate',
|
|
||||||
fields=[
|
|
||||||
('id', models.AutoField(verbose_name='ID', auto_created=True, primary_key=True, serialize=False)),
|
|
||||||
('name', models.CharField(max_length=50)),
|
|
||||||
('setup_date', models.DateField(null=True, blank=True)),
|
|
||||||
('setup_time', models.TimeField(null=True, blank=True)),
|
|
||||||
('setup_sample_size', models.IntegerField(null=True, blank=True)),
|
|
||||||
('mass_g', models.FloatField(null=True, blank=True)),
|
|
||||||
('flaw', models.ForeignKey(null=True, to='experiments.Flaw', blank=True)),
|
|
||||||
('treatment', models.ForeignKey(to='experiments.Treatment')),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
migrations.AlterUniqueTogether(
|
|
||||||
name='treatmentreplicate',
|
|
||||||
unique_together=set([('treatment', 'name', 'setup_date', 'setup_time')]),
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -1,26 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('experiments', '0004_treatment_replicate'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.CreateModel(
|
|
||||||
name='AliveDeadCount',
|
|
||||||
fields=[
|
|
||||||
('id', models.AutoField(auto_created=True, verbose_name='ID', primary_key=True, serialize=False)),
|
|
||||||
('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(to='experiments.Flaw', blank=True, null=True)),
|
|
||||||
('treatment_replicate', models.ForeignKey(to='experiments.TreatmentReplicate')),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -1,20 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('collections_ccdb', '0001_initial'),
|
|
||||||
('experiments', '0005_alivedeadcount'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AddField(
|
|
||||||
model_name='experiment',
|
|
||||||
name='collections',
|
|
||||||
field=models.ManyToManyField(to='collections_ccdb.Collection'),
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -1,24 +0,0 @@
|
||||||
# -*- 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,
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -1,20 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('experiments', '0007_treatment_replicates_display'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AddField(
|
|
||||||
model_name='treatment',
|
|
||||||
name='display_name',
|
|
||||||
field=models.CharField(editable=False, default='x', max_length=255),
|
|
||||||
preserve_default=False,
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -1,38 +0,0 @@
|
||||||
from django.db import migrations
|
|
||||||
|
|
||||||
from ccdb.utils.data import get_data_sources
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
def migrate(apps, schema_editor):
|
|
||||||
sources = get_data_sources()
|
|
||||||
if not sources:
|
|
||||||
return
|
|
||||||
|
|
||||||
c = sources['db0']
|
|
||||||
|
|
||||||
Collection = apps.get_model('collections_ccdb', 'Collection')
|
|
||||||
Experiment = apps.get_model('experiments', 'Experiment')
|
|
||||||
|
|
||||||
for experiment in Experiment.objects.all():
|
|
||||||
experiment.collections.all().delete()
|
|
||||||
|
|
||||||
for r in c.execute('SELECT * FROM tbl_hash_collection_experiments;'):
|
|
||||||
c = Collection.objects.get(id=r[0])
|
|
||||||
e = Experiment.objects.get(id=r[1])
|
|
||||||
e.collections.add(c)
|
|
||||||
e.save()
|
|
||||||
|
|
||||||
def rollback(apps, schema_editor):
|
|
||||||
Experiment = apps.get_model('experiments', 'Experiment')
|
|
||||||
|
|
||||||
for experiment in Experiment.objects.all():
|
|
||||||
experiment.collections.all().delete()
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('experiments', '0009_DATA_initial'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.RunPython(migrate, rollback),
|
|
||||||
]
|
|
|
@ -1,74 +0,0 @@
|
||||||
# -*- 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),
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -1,12 +1,8 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
import autoslug.fields
|
import autoslug.fields
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -14,13 +10,13 @@ class Migration(migrations.Migration):
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='MunicipalLocation',
|
name='MunicipalLocation',
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
('id', models.AutoField(primary_key=True, serialize=False, verbose_name='ID', auto_created=True)),
|
||||||
('name', models.CharField(max_length=100)),
|
('name', models.CharField(max_length=100)),
|
||||||
('code', models.CharField(max_length=10, blank=True)),
|
('code', models.CharField(blank=True, max_length=10)),
|
||||||
('municipal_location_type', models.CharField(max_length=50, blank=True)),
|
('municipal_location_type', models.CharField(blank=True, max_length=50)),
|
||||||
('description', models.CharField(max_length=255, blank=True)),
|
('description', models.CharField(blank=True, max_length=255)),
|
||||||
('sort_order', models.IntegerField(null=True, blank=True)),
|
('sort_order', models.IntegerField(blank=True, null=True)),
|
||||||
('slug', autoslug.fields.AutoSlugField(populate_from='name', editable=False)),
|
('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name')),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'ordering': ['sort_order'],
|
'ordering': ['sort_order'],
|
||||||
|
@ -29,11 +25,11 @@ class Migration(migrations.Migration):
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='Region',
|
name='Region',
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
('id', models.AutoField(primary_key=True, serialize=False, verbose_name='ID', auto_created=True)),
|
||||||
('name', models.CharField(max_length=100)),
|
('name', models.CharField(max_length=100)),
|
||||||
('code', models.CharField(max_length=10, blank=True)),
|
('code', models.CharField(blank=True, max_length=10)),
|
||||||
('sort_order', models.IntegerField(null=True, blank=True)),
|
('sort_order', models.IntegerField(blank=True, null=True)),
|
||||||
('slug', autoslug.fields.AutoSlugField(populate_from='name', editable=False)),
|
('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name')),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'ordering': ['sort_order'],
|
'ordering': ['sort_order'],
|
||||||
|
@ -42,12 +38,12 @@ class Migration(migrations.Migration):
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='Site',
|
name='Site',
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
('id', models.AutoField(primary_key=True, serialize=False, verbose_name='ID', auto_created=True)),
|
||||||
('name', models.CharField(max_length=100)),
|
('name', models.CharField(max_length=100)),
|
||||||
('code', models.CharField(max_length=10, blank=True)),
|
('code', models.CharField(blank=True, max_length=10)),
|
||||||
('description', models.CharField(max_length=255, blank=True)),
|
('description', models.CharField(blank=True, max_length=255)),
|
||||||
('sort_order', models.IntegerField(null=True, blank=True)),
|
('sort_order', models.IntegerField(blank=True, null=True)),
|
||||||
('slug', autoslug.fields.AutoSlugField(populate_from='name', editable=False)),
|
('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name')),
|
||||||
('region', models.ForeignKey(to='locations.Region', null=True, blank=True)),
|
('region', models.ForeignKey(to='locations.Region', null=True, blank=True)),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
|
@ -57,15 +53,15 @@ class Migration(migrations.Migration):
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='StorageLocation',
|
name='StorageLocation',
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
('id', models.AutoField(primary_key=True, serialize=False, verbose_name='ID', auto_created=True)),
|
||||||
('facility', models.CharField(max_length=100)),
|
('facility', models.CharField(max_length=100)),
|
||||||
('building', models.CharField(max_length=100)),
|
('building', models.CharField(max_length=100)),
|
||||||
('code', models.CharField(max_length=100)),
|
('code', models.CharField(max_length=100)),
|
||||||
('room', models.CharField(max_length=50, blank=True)),
|
('room', models.CharField(blank=True, max_length=50)),
|
||||||
('freezer', models.CharField(max_length=50, blank=True)),
|
('freezer', models.CharField(blank=True, max_length=50)),
|
||||||
('temp_c', models.IntegerField(null=True, blank=True)),
|
('temp_c', models.IntegerField(blank=True, null=True)),
|
||||||
('description', models.CharField(max_length=255, blank=True)),
|
('description', models.CharField(blank=True, max_length=255)),
|
||||||
('sort_order', models.IntegerField(null=True, blank=True)),
|
('sort_order', models.IntegerField(blank=True, null=True)),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'ordering': ['sort_order'],
|
'ordering': ['sort_order'],
|
||||||
|
@ -74,15 +70,15 @@ class Migration(migrations.Migration):
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='StudyLocation',
|
name='StudyLocation',
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
('id', models.AutoField(primary_key=True, serialize=False, verbose_name='ID', auto_created=True)),
|
||||||
('name', models.CharField(max_length=100)),
|
('name', models.CharField(max_length=100)),
|
||||||
('code', models.CharField(max_length=10, blank=True)),
|
('code', models.CharField(blank=True, max_length=10)),
|
||||||
('study_location_type', models.CharField(max_length=50, blank=True)),
|
('study_location_type', models.CharField(blank=True, max_length=50)),
|
||||||
('treatment_type', models.CharField(max_length=100, blank=True)),
|
('treatment_type', models.CharField(blank=True, max_length=100)),
|
||||||
('collecting_location', models.BooleanField(default=False)),
|
('collecting_location', models.BooleanField(default=False)),
|
||||||
('description', models.CharField(max_length=255, blank=True)),
|
('description', models.CharField(blank=True, max_length=255)),
|
||||||
('sort_order', models.IntegerField(null=True, blank=True)),
|
('sort_order', models.IntegerField(blank=True, null=True)),
|
||||||
('slug', autoslug.fields.AutoSlugField(populate_from='name', editable=False)),
|
('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name')),
|
||||||
('municipal_location', models.ForeignKey(to='locations.MunicipalLocation', null=True, blank=True)),
|
('municipal_location', models.ForeignKey(to='locations.MunicipalLocation', null=True, blank=True)),
|
||||||
('site', models.ForeignKey(to='locations.Site', null=True, blank=True)),
|
('site', models.ForeignKey(to='locations.Site', null=True, blank=True)),
|
||||||
],
|
],
|
||||||
|
@ -94,13 +90,33 @@ class Migration(migrations.Migration):
|
||||||
name='region',
|
name='region',
|
||||||
unique_together=set([('name', 'code')]),
|
unique_together=set([('name', 'code')]),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
|
||||||
model_name='municipallocation',
|
|
||||||
name='site',
|
|
||||||
field=models.ForeignKey(to='locations.Site'),
|
|
||||||
),
|
|
||||||
migrations.AlterUniqueTogether(
|
migrations.AlterUniqueTogether(
|
||||||
name='studylocation',
|
name='studylocation',
|
||||||
unique_together=set([('site', 'name')]),
|
unique_together=set([('site', 'name')]),
|
||||||
),
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='studylocation',
|
||||||
|
name='site',
|
||||||
|
field=models.ForeignKey(to='locations.Site'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='studylocation',
|
||||||
|
name='code',
|
||||||
|
field=models.CharField(max_length=10),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='site',
|
||||||
|
name='region',
|
||||||
|
field=models.ForeignKey(to='locations.Region', null=True, blank=True, related_name='sites'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='studylocation',
|
||||||
|
name='municipal_location',
|
||||||
|
field=models.ForeignKey(to='locations.MunicipalLocation', null=True, blank=True, related_name='study_locations'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='studylocation',
|
||||||
|
name='site',
|
||||||
|
field=models.ForeignKey(to='locations.Site', related_name='study_locations'),
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -94,7 +94,8 @@ class Migration(migrations.Migration):
|
||||||
model.objects.all().delete()
|
model.objects.all().delete()
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('locations', '0003_study_location_code_req'),
|
('locations', '0001_initial'),
|
||||||
|
('misc', '0002_DATA_initial'),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
|
@ -1,23 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('locations', '0001_initial'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.RemoveField(
|
|
||||||
model_name='municipallocation',
|
|
||||||
name='site',
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='studylocation',
|
|
||||||
name='site',
|
|
||||||
field=models.ForeignKey(to='locations.Site'),
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -1,19 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('locations', '0002_remove_site_fk_dupes'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='studylocation',
|
|
||||||
name='code',
|
|
||||||
field=models.CharField(max_length=10),
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -1,29 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('locations', '0004_DATA_initial'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='site',
|
|
||||||
name='region',
|
|
||||||
field=models.ForeignKey(blank=True, related_name='sites', null=True, to='locations.Region'),
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='studylocation',
|
|
||||||
name='municipal_location',
|
|
||||||
field=models.ForeignKey(blank=True, related_name='study_locations', null=True, to='locations.MunicipalLocation'),
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='studylocation',
|
|
||||||
name='site',
|
|
||||||
field=models.ForeignKey(related_name='study_locations', to='locations.Site'),
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -1,12 +1,8 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
import autoslug.fields
|
import autoslug.fields
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -14,11 +10,11 @@ class Migration(migrations.Migration):
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='Color',
|
name='Color',
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.AutoField(primary_key=True, serialize=False, auto_created=True, verbose_name='ID')),
|
('id', models.AutoField(serialize=False, primary_key=True, verbose_name='ID', auto_created=True)),
|
||||||
('name', models.CharField(max_length=50)),
|
('name', models.CharField(max_length=50)),
|
||||||
('code', models.CharField(blank=True, max_length=10)),
|
('code', models.CharField(max_length=10, blank=True)),
|
||||||
('color_number', models.FloatField(null=True, blank=True)),
|
('color_number', models.FloatField(blank=True, null=True)),
|
||||||
('sort_order', models.IntegerField(null=True, blank=True)),
|
('sort_order', models.IntegerField(blank=True, null=True)),
|
||||||
('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name')),
|
('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name')),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
|
@ -28,14 +24,14 @@ class Migration(migrations.Migration):
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='Container',
|
name='Container',
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.AutoField(primary_key=True, serialize=False, auto_created=True, verbose_name='ID')),
|
('id', models.AutoField(serialize=False, primary_key=True, verbose_name='ID', auto_created=True)),
|
||||||
('name', models.CharField(max_length=100)),
|
('name', models.CharField(max_length=100)),
|
||||||
('code', models.CharField(blank=True, max_length=10)),
|
('code', models.CharField(max_length=10, blank=True)),
|
||||||
('application', models.CharField(blank=True, max_length=50)),
|
('application', models.CharField(max_length=50, blank=True)),
|
||||||
('volume', models.FloatField(null=True, blank=True)),
|
('volume', models.FloatField(blank=True, null=True)),
|
||||||
('sort_order', models.IntegerField(null=True, blank=True)),
|
('sort_order', models.IntegerField(blank=True, null=True)),
|
||||||
('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name')),
|
('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name')),
|
||||||
('color', models.ForeignKey(null=True, to='misc.Color', blank=True)),
|
('color', models.ForeignKey(blank=True, to='misc.Color', null=True)),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'ordering': ['sort_order'],
|
'ordering': ['sort_order'],
|
||||||
|
@ -44,12 +40,12 @@ class Migration(migrations.Migration):
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='Material',
|
name='Material',
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.AutoField(primary_key=True, serialize=False, auto_created=True, verbose_name='ID')),
|
('id', models.AutoField(serialize=False, primary_key=True, verbose_name='ID', auto_created=True)),
|
||||||
('name', models.CharField(max_length=100)),
|
('name', models.CharField(max_length=100)),
|
||||||
('code', models.CharField(blank=True, max_length=10)),
|
('code', models.CharField(max_length=10, blank=True)),
|
||||||
('material_class', models.CharField(blank=True, max_length=50)),
|
('material_class', models.CharField(max_length=50, blank=True)),
|
||||||
('description', models.CharField(blank=True, max_length=255)),
|
('description', models.CharField(max_length=255, blank=True)),
|
||||||
('sort_order', models.IntegerField(null=True, blank=True)),
|
('sort_order', models.IntegerField(blank=True, null=True)),
|
||||||
('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name')),
|
('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name')),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
|
@ -59,12 +55,12 @@ class Migration(migrations.Migration):
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='MeasurementType',
|
name='MeasurementType',
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.AutoField(primary_key=True, serialize=False, auto_created=True, verbose_name='ID')),
|
('id', models.AutoField(serialize=False, primary_key=True, verbose_name='ID', auto_created=True)),
|
||||||
('name', models.CharField(max_length=100)),
|
('name', models.CharField(max_length=100)),
|
||||||
('code', models.CharField(blank=True, max_length=10)),
|
('code', models.CharField(max_length=10, blank=True)),
|
||||||
('measurement_type_class', models.CharField(blank=True, max_length=50)),
|
('measurement_type_class', models.CharField(max_length=50, blank=True)),
|
||||||
('description', models.CharField(blank=True, max_length=255)),
|
('description', models.CharField(max_length=255, blank=True)),
|
||||||
('sort_order', models.IntegerField(null=True, blank=True)),
|
('sort_order', models.IntegerField(blank=True, null=True)),
|
||||||
('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name')),
|
('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name')),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
|
@ -74,12 +70,12 @@ class Migration(migrations.Migration):
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='MeasurementUnit',
|
name='MeasurementUnit',
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.AutoField(primary_key=True, serialize=False, auto_created=True, verbose_name='ID')),
|
('id', models.AutoField(serialize=False, primary_key=True, verbose_name='ID', auto_created=True)),
|
||||||
('name', models.CharField(max_length=100)),
|
('name', models.CharField(max_length=100)),
|
||||||
('code', models.CharField(max_length=25)),
|
('code', models.CharField(max_length=25)),
|
||||||
('unit_class', models.CharField(blank=True, max_length=50)),
|
('unit_class', models.CharField(max_length=50, blank=True)),
|
||||||
('description', models.CharField(blank=True, max_length=255)),
|
('description', models.CharField(max_length=255, blank=True)),
|
||||||
('sort_order', models.IntegerField(null=True, blank=True)),
|
('sort_order', models.IntegerField(blank=True, null=True)),
|
||||||
('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name')),
|
('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name')),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
|
@ -93,7 +89,7 @@ class Migration(migrations.Migration):
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='measurementtype',
|
model_name='measurementtype',
|
||||||
name='default_measurement_unit',
|
name='default_measurement_unit',
|
||||||
field=models.ForeignKey(null=True, to='misc.MeasurementUnit', blank=True),
|
field=models.ForeignKey(blank=True, to='misc.MeasurementUnit', null=True),
|
||||||
),
|
),
|
||||||
migrations.AlterUniqueTogether(
|
migrations.AlterUniqueTogether(
|
||||||
name='material',
|
name='material',
|
||||||
|
@ -102,15 +98,35 @@ class Migration(migrations.Migration):
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='container',
|
model_name='container',
|
||||||
name='material',
|
name='material',
|
||||||
field=models.ForeignKey(null=True, to='misc.Material', blank=True),
|
field=models.ForeignKey(blank=True, to='misc.Material', null=True),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='container',
|
model_name='container',
|
||||||
name='measurement_unit',
|
name='measurement_unit',
|
||||||
field=models.ForeignKey(null=True, to='misc.MeasurementUnit', blank=True),
|
field=models.ForeignKey(blank=True, to='misc.MeasurementUnit', null=True),
|
||||||
),
|
),
|
||||||
migrations.AlterUniqueTogether(
|
migrations.AlterUniqueTogether(
|
||||||
name='color',
|
name='color',
|
||||||
unique_together=set([('name', 'code', 'color_number')]),
|
unique_together=set([('name', 'code', 'color_number')]),
|
||||||
),
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='container',
|
||||||
|
name='color',
|
||||||
|
field=models.ForeignKey(blank=True, to='misc.Color', related_name='containers', null=True),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='container',
|
||||||
|
name='material',
|
||||||
|
field=models.ForeignKey(blank=True, to='misc.Material', related_name='containers', null=True),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='container',
|
||||||
|
name='measurement_unit',
|
||||||
|
field=models.ForeignKey(blank=True, to='misc.MeasurementUnit', related_name='containers', null=True),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='measurementtype',
|
||||||
|
name='default_measurement_unit',
|
||||||
|
field=models.ForeignKey(blank=True, to='misc.MeasurementUnit', related_name='measurement_types', null=True),
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -104,6 +104,7 @@ class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('misc', '0001_initial'),
|
('misc', '0001_initial'),
|
||||||
|
('projects', '0002_DATA_initial'),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('misc', '0002_DATA_initial'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='container',
|
|
||||||
name='color',
|
|
||||||
field=models.ForeignKey(related_name='containers', blank=True, to='misc.Color', null=True),
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='container',
|
|
||||||
name='material',
|
|
||||||
field=models.ForeignKey(related_name='containers', blank=True, to='misc.Material', null=True),
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='container',
|
|
||||||
name='measurement_unit',
|
|
||||||
field=models.ForeignKey(related_name='containers', blank=True, to='misc.MeasurementUnit', null=True),
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='measurementtype',
|
|
||||||
name='default_measurement_unit',
|
|
||||||
field=models.ForeignKey(related_name='measurement_types', blank=True, to='misc.MeasurementUnit', null=True),
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -1,12 +1,8 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
import autoslug.fields
|
import autoslug.fields
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('misc', '0001_initial'),
|
('misc', '0001_initial'),
|
||||||
]
|
]
|
||||||
|
@ -15,10 +11,10 @@ class Migration(migrations.Migration):
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='Flaw',
|
name='Flaw',
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.AutoField(primary_key=True, auto_created=True, verbose_name='ID', serialize=False)),
|
('id', models.AutoField(auto_created=True, verbose_name='ID', serialize=False, primary_key=True)),
|
||||||
('name', models.CharField(max_length=200)),
|
('name', models.CharField(max_length=200)),
|
||||||
('description', models.CharField(blank=True, max_length=255)),
|
('description', models.CharField(max_length=255, blank=True)),
|
||||||
('sort_order', models.IntegerField(blank=True, null=True)),
|
('sort_order', models.IntegerField(null=True, blank=True)),
|
||||||
('slug', autoslug.fields.AutoSlugField(populate_from='name', editable=False)),
|
('slug', autoslug.fields.AutoSlugField(populate_from='name', editable=False)),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
|
@ -28,25 +24,25 @@ class Migration(migrations.Migration):
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='Processing',
|
name='Processing',
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.AutoField(primary_key=True, auto_created=True, verbose_name='ID', serialize=False)),
|
('id', models.AutoField(auto_created=True, verbose_name='ID', serialize=False, primary_key=True)),
|
||||||
('container_label', models.CharField(max_length=50)),
|
('container_label', models.CharField(max_length=50)),
|
||||||
('process_date', models.DateField(blank=True, null=True)),
|
('process_date', models.DateField(null=True, blank=True)),
|
||||||
('process_time', models.TimeField(blank=True, null=True)),
|
('process_time', models.TimeField(null=True, blank=True)),
|
||||||
('reagent_volume', models.FloatField(blank=True, null=True)),
|
('reagent_volume', models.FloatField(null=True, blank=True)),
|
||||||
('minutes_in_reagent', models.IntegerField(blank=True, null=True)),
|
('minutes_in_reagent', models.IntegerField(null=True, blank=True)),
|
||||||
('container', models.ForeignKey(to='misc.Container')),
|
('container', models.ForeignKey(to='misc.Container')),
|
||||||
('flaw', models.ForeignKey(to='processing.Flaw', blank=True, null=True)),
|
('flaw', models.ForeignKey(to='processing.Flaw', null=True, blank=True)),
|
||||||
('measurement_unit', models.ForeignKey(to='misc.MeasurementUnit', blank=True, null=True)),
|
('measurement_unit', models.ForeignKey(to='misc.MeasurementUnit', null=True, blank=True)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='ProcessType',
|
name='ProcessType',
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.AutoField(primary_key=True, auto_created=True, verbose_name='ID', serialize=False)),
|
('id', models.AutoField(auto_created=True, verbose_name='ID', serialize=False, primary_key=True)),
|
||||||
('name', models.CharField(max_length=100)),
|
('name', models.CharField(max_length=100)),
|
||||||
('code', models.CharField(blank=True, max_length=10)),
|
('code', models.CharField(max_length=10, blank=True)),
|
||||||
('description', models.CharField(blank=True, max_length=255)),
|
('description', models.CharField(max_length=255, blank=True)),
|
||||||
('sort_order', models.IntegerField(blank=True, null=True)),
|
('sort_order', models.IntegerField(null=True, blank=True)),
|
||||||
('slug', autoslug.fields.AutoSlugField(populate_from='name', editable=False)),
|
('slug', autoslug.fields.AutoSlugField(populate_from='name', editable=False)),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
|
@ -56,11 +52,11 @@ class Migration(migrations.Migration):
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='Reagent',
|
name='Reagent',
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.AutoField(primary_key=True, auto_created=True, verbose_name='ID', serialize=False)),
|
('id', models.AutoField(auto_created=True, verbose_name='ID', serialize=False, primary_key=True)),
|
||||||
('name', models.CharField(max_length=100)),
|
('name', models.CharField(max_length=100)),
|
||||||
('code', models.CharField(blank=True, max_length=10)),
|
('code', models.CharField(max_length=10, blank=True)),
|
||||||
('reagent_class', models.CharField(blank=True, max_length=50)),
|
('reagent_class', models.CharField(max_length=50, blank=True)),
|
||||||
('sort_order', models.IntegerField(blank=True, null=True)),
|
('sort_order', models.IntegerField(null=True, blank=True)),
|
||||||
('slug', autoslug.fields.AutoSlugField(populate_from='name', editable=False)),
|
('slug', autoslug.fields.AutoSlugField(populate_from='name', editable=False)),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
|
@ -83,10 +79,35 @@ class Migration(migrations.Migration):
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='processing',
|
model_name='processing',
|
||||||
name='reagent',
|
name='reagent',
|
||||||
field=models.ForeignKey(to='processing.Reagent', blank=True, null=True),
|
field=models.ForeignKey(to='processing.Reagent', null=True, blank=True),
|
||||||
),
|
),
|
||||||
migrations.AlterUniqueTogether(
|
migrations.AlterUniqueTogether(
|
||||||
name='processing',
|
name='processing',
|
||||||
unique_together=set([('process_type', 'container', 'container_label', 'process_date', 'process_time', 'reagent')]),
|
unique_together=set([('process_type', 'container', 'container_label', 'process_date', 'process_time', 'reagent')]),
|
||||||
),
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='processing',
|
||||||
|
name='container',
|
||||||
|
field=models.ForeignKey(related_name='processings', to='misc.Container'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='processing',
|
||||||
|
name='flaw',
|
||||||
|
field=models.ForeignKey(to='processing.Flaw', null=True, related_name='processings', blank=True),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='processing',
|
||||||
|
name='measurement_unit',
|
||||||
|
field=models.ForeignKey(to='misc.MeasurementUnit', null=True, related_name='processings', blank=True),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='processing',
|
||||||
|
name='process_type',
|
||||||
|
field=models.ForeignKey(related_name='processings', to='processing.ProcessType'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='processing',
|
||||||
|
name='reagent',
|
||||||
|
field=models.ForeignKey(to='processing.Reagent', null=True, related_name='processings', blank=True),
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -50,6 +50,7 @@ class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('processing', '0001_initial'),
|
('processing', '0001_initial'),
|
||||||
|
('species', '0002_DATA_initial'),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
@ -1,39 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('processing', '0002_DATA_initial'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='processing',
|
|
||||||
name='container',
|
|
||||||
field=models.ForeignKey(related_name='processings', to='misc.Container'),
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='processing',
|
|
||||||
name='flaw',
|
|
||||||
field=models.ForeignKey(to='processing.Flaw', blank=True, related_name='processings', null=True),
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='processing',
|
|
||||||
name='measurement_unit',
|
|
||||||
field=models.ForeignKey(to='misc.MeasurementUnit', blank=True, related_name='processings', null=True),
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='processing',
|
|
||||||
name='process_type',
|
|
||||||
field=models.ForeignKey(related_name='processings', to='processing.ProcessType'),
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='processing',
|
|
||||||
name='reagent',
|
|
||||||
field=models.ForeignKey(to='processing.Reagent', blank=True, related_name='processings', null=True),
|
|
||||||
),
|
|
||||||
]
|
|
77
ccdb/projects/migrations/0001_initial.py
Normal file
77
ccdb/projects/migrations/0001_initial.py
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
from django.db import migrations, models
|
||||||
|
import autoslug.fields
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
dependencies = [
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Project',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(serialize=False, auto_created=True, verbose_name='ID', primary_key=True)),
|
||||||
|
('name', models.CharField(max_length=100)),
|
||||||
|
('code', models.CharField(blank=True, max_length=10)),
|
||||||
|
('iacuc_number', models.CharField(blank=True, max_length=25)),
|
||||||
|
('description', models.CharField(blank=True, max_length=255)),
|
||||||
|
('sort_order', models.IntegerField(blank=True, null=True)),
|
||||||
|
('slug', autoslug.fields.AutoSlugField(populate_from='name', editable=False)),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'ordering': ['sort_order'],
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.AlterUniqueTogether(
|
||||||
|
name='project',
|
||||||
|
unique_together=set([('name', 'code')]),
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Grant',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(serialize=False, auto_created=True, verbose_name='ID', primary_key=True)),
|
||||||
|
('title', models.CharField(max_length=200)),
|
||||||
|
('code', models.CharField(blank=True, max_length=10)),
|
||||||
|
('description', models.CharField(blank=True, max_length=255)),
|
||||||
|
('sort_order', models.IntegerField(blank=True, null=True)),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'ordering': ['sort_order'],
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.AlterUniqueTogether(
|
||||||
|
name='grant',
|
||||||
|
unique_together=set([('title', 'code')]),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='grant',
|
||||||
|
name='projects',
|
||||||
|
field=models.ManyToManyField(related_name='grants', to='projects.Project'),
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='GrantReport',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(serialize=False, auto_created=True, verbose_name='ID', primary_key=True)),
|
||||||
|
('title', models.CharField(max_length=200)),
|
||||||
|
('report_type', models.CharField(blank=True, max_length=50)),
|
||||||
|
('description', models.CharField(blank=True, max_length=255)),
|
||||||
|
('due_date', models.DateField(blank=True, null=True)),
|
||||||
|
('submitted_date', models.DateField(blank=True, null=True)),
|
||||||
|
('attachment', models.FileField(blank=True, null=True, upload_to='projects/grants/grant_report_attachments/%Y/%m/%d')),
|
||||||
|
('sort_order', models.IntegerField(blank=True, null=True)),
|
||||||
|
('grant', models.ForeignKey(to='projects.Grant')),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'ordering': ['sort_order'],
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.AlterUniqueTogether(
|
||||||
|
name='grantreport',
|
||||||
|
unique_together=set([('grant', 'title', 'due_date')]),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='grantreport',
|
||||||
|
name='grant',
|
||||||
|
field=models.ForeignKey(related_name='reports', to='projects.Grant'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -1,33 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
import autoslug.fields
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.CreateModel(
|
|
||||||
name='Project',
|
|
||||||
fields=[
|
|
||||||
('id', models.AutoField(serialize=False, primary_key=True, auto_created=True, verbose_name='ID')),
|
|
||||||
('name', models.CharField(max_length=100)),
|
|
||||||
('code', models.CharField(max_length=10, blank=True)),
|
|
||||||
('iacuc_number', models.CharField(max_length=25, blank=True)),
|
|
||||||
('description', models.CharField(max_length=255, blank=True)),
|
|
||||||
('sort_order', models.IntegerField(null=True, blank=True)),
|
|
||||||
('slug', autoslug.fields.AutoSlugField(populate_from='name', editable=False)),
|
|
||||||
],
|
|
||||||
options={
|
|
||||||
'ordering': ['sort_order'],
|
|
||||||
},
|
|
||||||
),
|
|
||||||
migrations.AlterUniqueTogether(
|
|
||||||
name='project',
|
|
||||||
unique_together=set([('name', 'code')]),
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -8,7 +8,6 @@ class Migration(migrations.Migration):
|
||||||
def migrate(apps, schema_editor):
|
def migrate(apps, schema_editor):
|
||||||
sources = get_data_sources()
|
sources = get_data_sources()
|
||||||
if not sources:
|
if not sources:
|
||||||
print('no sources')
|
|
||||||
return
|
return
|
||||||
|
|
||||||
c = sources['db0']
|
c = sources['db0']
|
||||||
|
@ -75,7 +74,7 @@ class Migration(migrations.Migration):
|
||||||
model.objects.all().delete()
|
model.objects.all().delete()
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('projects', '0004_initial_grantreport'),
|
('projects', '0001_initial'),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
|
@ -1,31 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('projects', '0001_initial_project'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.CreateModel(
|
|
||||||
name='Grant',
|
|
||||||
fields=[
|
|
||||||
('id', models.AutoField(serialize=False, verbose_name='ID', auto_created=True, primary_key=True)),
|
|
||||||
('title', models.CharField(max_length=200)),
|
|
||||||
('code', models.CharField(max_length=10, blank=True)),
|
|
||||||
('description', models.CharField(max_length=255, blank=True)),
|
|
||||||
('sort_order', models.IntegerField(null=True, blank=True)),
|
|
||||||
],
|
|
||||||
options={
|
|
||||||
'ordering': ['sort_order'],
|
|
||||||
},
|
|
||||||
),
|
|
||||||
migrations.AlterUniqueTogether(
|
|
||||||
name='grant',
|
|
||||||
unique_together=set([('title', 'code')]),
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -1,19 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('projects', '0002_initial_grant'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AddField(
|
|
||||||
model_name='grant',
|
|
||||||
name='projects',
|
|
||||||
field=models.ManyToManyField(to='projects.Project', related_name='grants'),
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -1,35 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('projects', '0003_grant_projects'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.CreateModel(
|
|
||||||
name='GrantReport',
|
|
||||||
fields=[
|
|
||||||
('id', models.AutoField(auto_created=True, verbose_name='ID', primary_key=True, serialize=False)),
|
|
||||||
('title', models.CharField(max_length=200)),
|
|
||||||
('report_type', models.CharField(max_length=50, blank=True)),
|
|
||||||
('description', models.CharField(max_length=255, blank=True)),
|
|
||||||
('due_date', models.DateField(blank=True, null=True)),
|
|
||||||
('submitted_date', models.DateField(blank=True, null=True)),
|
|
||||||
('attachment', models.FileField(upload_to='projects/grants/grant_report_attachments/%Y/%m/%d', blank=True, null=True)),
|
|
||||||
('sort_order', models.IntegerField(blank=True, null=True)),
|
|
||||||
('grant', models.ForeignKey(to='projects.Grant')),
|
|
||||||
],
|
|
||||||
options={
|
|
||||||
'ordering': ['sort_order'],
|
|
||||||
},
|
|
||||||
),
|
|
||||||
migrations.AlterUniqueTogether(
|
|
||||||
name='grantreport',
|
|
||||||
unique_together=set([('grant', 'title', 'due_date')]),
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -1,19 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('projects', '0005_DATA_initial'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='grantreport',
|
|
||||||
name='grant',
|
|
||||||
field=models.ForeignKey(to='projects.Grant', related_name='reports'),
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -1,26 +1,23 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
import autoslug.fields
|
import autoslug.fields
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
('collections_ccdb', '0001_initial'),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='Species',
|
name='Species',
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.AutoField(primary_key=True, verbose_name='ID', serialize=False, auto_created=True)),
|
('id', models.AutoField(auto_created=True, primary_key=True, verbose_name='ID', serialize=False)),
|
||||||
('common_name', models.CharField(max_length=100)),
|
('common_name', models.CharField(max_length=100)),
|
||||||
('genus', models.CharField(max_length=50, blank=True)),
|
('genus', models.CharField(max_length=50, blank=True)),
|
||||||
('species', models.CharField(max_length=50, blank=True)),
|
('species', models.CharField(max_length=50, blank=True)),
|
||||||
('parasite', models.BooleanField(default=False)),
|
('parasite', models.BooleanField(default=False)),
|
||||||
('sort_order', models.IntegerField(blank=True, null=True)),
|
('sort_order', models.IntegerField(blank=True, null=True)),
|
||||||
('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='common_name')),
|
('slug', autoslug.fields.AutoSlugField(populate_from='common_name', editable=False)),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'ordering': ['sort_order'],
|
'ordering': ['sort_order'],
|
||||||
|
@ -31,4 +28,56 @@ class Migration(migrations.Migration):
|
||||||
name='species',
|
name='species',
|
||||||
unique_together=set([('common_name', 'species')]),
|
unique_together=set([('common_name', 'species')]),
|
||||||
),
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='TrapSpecies',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(auto_created=True, primary_key=True, verbose_name='ID', serialize=False)),
|
||||||
|
('sex', models.CharField(max_length=25, blank=True)),
|
||||||
|
('count', models.IntegerField(blank=True, null=True)),
|
||||||
|
('count_estimated', models.BooleanField(default=False)),
|
||||||
|
('collection_trap', models.ForeignKey(to='collections_ccdb.CollectionTrap')),
|
||||||
|
('species', models.ForeignKey(to='species.Species')),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'verbose_name_plural': 'trap-species',
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='CollectionSpecies',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(auto_created=True, primary_key=True, verbose_name='ID', serialize=False)),
|
||||||
|
('sex', models.CharField(max_length=25, blank=True)),
|
||||||
|
('count', models.IntegerField(blank=True, null=True)),
|
||||||
|
('count_estimated', models.BooleanField(default=False)),
|
||||||
|
('collection', models.ForeignKey(to='collections_ccdb.Collection')),
|
||||||
|
('species', models.ForeignKey(to='species.Species')),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'verbose_name_plural': 'collection-species',
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.AlterUniqueTogether(
|
||||||
|
name='collectionspecies',
|
||||||
|
unique_together=set([('collection', 'species')]),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='collectionspecies',
|
||||||
|
name='collection',
|
||||||
|
field=models.ForeignKey(to='collections_ccdb.Collection', related_name='collection_species'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='collectionspecies',
|
||||||
|
name='species',
|
||||||
|
field=models.ForeignKey(to='species.Species', related_name='collection_species'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='trapspecies',
|
||||||
|
name='collection_trap',
|
||||||
|
field=models.ForeignKey(to='collections_ccdb.CollectionTrap', related_name='trap_species'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='trapspecies',
|
||||||
|
name='species',
|
||||||
|
field=models.ForeignKey(to='species.Species', related_name='trap_species'),
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -27,12 +27,14 @@ class Migration(migrations.Migration):
|
||||||
else:
|
else:
|
||||||
print('species', r[0:], form.errors.as_data())
|
print('species', r[0:], form.errors.as_data())
|
||||||
|
|
||||||
|
|
||||||
def rollback(apps, schema_editor):
|
def rollback(apps, schema_editor):
|
||||||
Species = apps.get_model('species', 'Species')
|
Species = apps.get_model('species', 'Species')
|
||||||
Species.objects.all().delete()
|
Species.objects.all().delete()
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('species', '0003_collectionspecies'),
|
('species', '0001_initial'),
|
||||||
|
('locations', '0002_DATA_initial'),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
|
@ -1,29 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('collections_ccdb', '0001_initial'),
|
|
||||||
('species', '0001_initial'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.CreateModel(
|
|
||||||
name='TrapSpecies',
|
|
||||||
fields=[
|
|
||||||
('id', models.AutoField(auto_created=True, verbose_name='ID', primary_key=True, serialize=False)),
|
|
||||||
('sex', models.CharField(blank=True, max_length=25)),
|
|
||||||
('count', models.IntegerField(blank=True, null=True)),
|
|
||||||
('count_estimated', models.BooleanField(default=False)),
|
|
||||||
('collection_trap', models.ForeignKey(to='collections_ccdb.CollectionTrap')),
|
|
||||||
('species', models.ForeignKey(to='species.Species')),
|
|
||||||
],
|
|
||||||
options={
|
|
||||||
'verbose_name_plural': 'trap-species',
|
|
||||||
},
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -1,33 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('collections_ccdb', '0001_initial'),
|
|
||||||
('species', '0002_trapspecies'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.CreateModel(
|
|
||||||
name='CollectionSpecies',
|
|
||||||
fields=[
|
|
||||||
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True, serialize=False)),
|
|
||||||
('sex', models.CharField(blank=True, max_length=25)),
|
|
||||||
('count', models.IntegerField(null=True, blank=True)),
|
|
||||||
('count_estimated', models.BooleanField(default=False)),
|
|
||||||
('collection', models.ForeignKey(to='collections_ccdb.Collection')),
|
|
||||||
('species', models.ForeignKey(to='species.Species')),
|
|
||||||
],
|
|
||||||
options={
|
|
||||||
'verbose_name_plural': 'collection-species',
|
|
||||||
},
|
|
||||||
),
|
|
||||||
migrations.AlterUniqueTogether(
|
|
||||||
name='collectionspecies',
|
|
||||||
unique_together=set([('collection', 'species')]),
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -1,41 +0,0 @@
|
||||||
from django.db import migrations
|
|
||||||
from django.forms import modelform_factory
|
|
||||||
|
|
||||||
from ccdb.utils.data import get_data_sources
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
def migrate(apps, schema_editor):
|
|
||||||
sources = get_data_sources()
|
|
||||||
if not sources:
|
|
||||||
return
|
|
||||||
|
|
||||||
c = sources['db0']
|
|
||||||
|
|
||||||
CollectionSpecies = apps.get_model('species', 'CollectionSpecies')
|
|
||||||
|
|
||||||
CollectionSpecies.objects.all().delete()
|
|
||||||
|
|
||||||
CollectionSpeciesForm = modelform_factory(CollectionSpecies, fields='__all__')
|
|
||||||
|
|
||||||
for r in c.execute('SELECT * FROM tbl_hash_collection_species;'):
|
|
||||||
form = CollectionSpeciesForm(dict(collection=r[0], species=r[1], sex=r[2],
|
|
||||||
count=r[3], count_estimated=r[4]))
|
|
||||||
if form.is_valid():
|
|
||||||
# No PK in Andre's file
|
|
||||||
form.save()
|
|
||||||
else:
|
|
||||||
print('collection species', r[0:], form.errors.as_data())
|
|
||||||
|
|
||||||
def rollback(apps, schema_editor):
|
|
||||||
CollectionSpecies = apps.get_model('species', 'CollectionSpecies')
|
|
||||||
CollectionSpecies.objects.all().delete()
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('species', '0004_DATA_initial'),
|
|
||||||
('collections_ccdb', '0005_DATA_initial'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.RunPython(migrate, rollback),
|
|
||||||
]
|
|
|
@ -1,34 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('species', '0005_DATA_species_collection'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='collectionspecies',
|
|
||||||
name='collection',
|
|
||||||
field=models.ForeignKey(related_name='collection_species', to='collections_ccdb.Collection'),
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='collectionspecies',
|
|
||||||
name='species',
|
|
||||||
field=models.ForeignKey(related_name='collection_species', to='species.Species'),
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='trapspecies',
|
|
||||||
name='collection_trap',
|
|
||||||
field=models.ForeignKey(related_name='trap_species', to='collections_ccdb.CollectionTrap'),
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='trapspecies',
|
|
||||||
name='species',
|
|
||||||
field=models.ForeignKey(related_name='trap_species', to='species.Species'),
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -16,17 +16,13 @@ DJANGO_APPS = (
|
||||||
'django.contrib.auth',
|
'django.contrib.auth',
|
||||||
'django.contrib.contenttypes',
|
'django.contrib.contenttypes',
|
||||||
'django.contrib.sessions',
|
'django.contrib.sessions',
|
||||||
|
'django.contrib.sites', # Need this for djoser
|
||||||
'django.contrib.messages',
|
'django.contrib.messages',
|
||||||
'django.contrib.staticfiles',
|
'django.contrib.staticfiles',
|
||||||
'grappelli',
|
'grappelli',
|
||||||
'django.contrib.admin',
|
'django.contrib.admin',
|
||||||
)
|
)
|
||||||
THIRD_PARTY_APPS = (
|
THIRD_PARTY_APPS = (
|
||||||
'crispy_forms',
|
|
||||||
'allauth',
|
|
||||||
'allauth.account',
|
|
||||||
'bootstrap3',
|
|
||||||
'django_tables2',
|
|
||||||
'rest_framework',
|
'rest_framework',
|
||||||
'rest_framework.authtoken',
|
'rest_framework.authtoken',
|
||||||
'corsheaders',
|
'corsheaders',
|
||||||
|
@ -242,3 +238,5 @@ REST_FRAMEWORK = {
|
||||||
'DEFAULT_PAGINATION_CLASS': 'drf_ember_pagination.EmberPageNumberPagination',
|
'DEFAULT_PAGINATION_CLASS': 'drf_ember_pagination.EmberPageNumberPagination',
|
||||||
'PAGE_SIZE': 100,
|
'PAGE_SIZE': 100,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SITE_ID = 1
|
||||||
|
|
Loading…
Add table
Reference in a new issue