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
|
||||
import autoslug.fields
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('locations', '0002_remove_site_fk_dupes'),
|
||||
('projects', '0004_initial_grantreport'),
|
||||
('projects', '0002_DATA_initial'),
|
||||
('processing', '0001_initial'),
|
||||
('locations', '0002_DATA_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='ADFGPermit',
|
||||
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)),
|
||||
('sort_order', models.IntegerField(null=True, blank=True)),
|
||||
('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name')),
|
||||
('sort_order', models.IntegerField(blank=True, null=True)),
|
||||
('slug', autoslug.fields.AutoSlugField(populate_from='name', editable=False)),
|
||||
],
|
||||
options={
|
||||
'ordering': ['sort_order'],
|
||||
|
@ -29,25 +25,25 @@ class Migration(migrations.Migration):
|
|||
migrations.CreateModel(
|
||||
name='Collection',
|
||||
fields=[
|
||||
('id', models.AutoField(primary_key=True, serialize=False, verbose_name='ID', auto_created=True)),
|
||||
('number_of_traps', models.IntegerField(null=True, blank=True)),
|
||||
('collection_start_date', models.DateField(null=True, blank=True)),
|
||||
('collection_start_time', models.TimeField(null=True, blank=True)),
|
||||
('collection_end_date', models.DateField(null=True, blank=True)),
|
||||
('collection_end_time', models.TimeField(null=True, blank=True)),
|
||||
('specimen_state', models.CharField(max_length=50, blank=True)),
|
||||
('adfg_permit', models.ForeignKey(to='collections_ccdb.ADFGPermit', blank=True, null=True)),
|
||||
('id', models.AutoField(verbose_name='ID', serialize=False, primary_key=True, auto_created=True)),
|
||||
('number_of_traps', models.IntegerField(blank=True, null=True)),
|
||||
('collection_start_date', models.DateField(blank=True, null=True)),
|
||||
('collection_start_time', models.TimeField(blank=True, null=True)),
|
||||
('collection_end_date', models.DateField(blank=True, null=True)),
|
||||
('collection_end_time', models.TimeField(blank=True, null=True)),
|
||||
('specimen_state', models.CharField(blank=True, max_length=50)),
|
||||
('adfg_permit', models.ForeignKey(blank=True, null=True, to='collections_ccdb.ADFGPermit')),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='CollectionMethod',
|
||||
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)),
|
||||
('code', models.CharField(max_length=10, blank=True)),
|
||||
('collection_method_class', models.CharField(max_length=50, blank=True)),
|
||||
('sort_order', models.IntegerField(null=True, blank=True)),
|
||||
('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name')),
|
||||
('code', models.CharField(blank=True, max_length=10)),
|
||||
('collection_method_class', models.CharField(blank=True, max_length=50)),
|
||||
('sort_order', models.IntegerField(blank=True, null=True)),
|
||||
('slug', autoslug.fields.AutoSlugField(populate_from='name', editable=False)),
|
||||
],
|
||||
options={
|
||||
'ordering': ['sort_order'],
|
||||
|
@ -56,7 +52,7 @@ class Migration(migrations.Migration):
|
|||
migrations.CreateModel(
|
||||
name='CollectionTrap',
|
||||
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()),
|
||||
('date_opened', models.DateField()),
|
||||
('time_opened', models.TimeField()),
|
||||
|
@ -68,11 +64,11 @@ class Migration(migrations.Migration):
|
|||
migrations.CreateModel(
|
||||
name='CollectionType',
|
||||
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)),
|
||||
('code', models.CharField(max_length=10, blank=True)),
|
||||
('sort_order', models.IntegerField(null=True, blank=True)),
|
||||
('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name')),
|
||||
('code', models.CharField(blank=True, max_length=10)),
|
||||
('sort_order', models.IntegerField(blank=True, null=True)),
|
||||
('slug', autoslug.fields.AutoSlugField(populate_from='name', editable=False)),
|
||||
],
|
||||
options={
|
||||
'ordering': ['sort_order'],
|
||||
|
@ -81,19 +77,19 @@ class Migration(migrations.Migration):
|
|||
migrations.CreateModel(
|
||||
name='DatasheetAttachment',
|
||||
fields=[
|
||||
('id', models.AutoField(primary_key=True, serialize=False, verbose_name='ID', auto_created=True)),
|
||||
('datasheet', models.FileField(verbose_name='Datasheet', upload_to='collections/datasheets/%Y/%m/%d')),
|
||||
('id', models.AutoField(verbose_name='ID', serialize=False, primary_key=True, auto_created=True)),
|
||||
('datasheet', models.FileField(upload_to='collections/datasheets/%Y/%m/%d', verbose_name='Datasheet')),
|
||||
('collection', models.ForeignKey(to='collections_ccdb.Collection')),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Flaw',
|
||||
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)),
|
||||
('description', models.CharField(max_length=255, blank=True)),
|
||||
('sort_order', models.IntegerField(null=True, blank=True)),
|
||||
('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name')),
|
||||
('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'],
|
||||
|
@ -120,12 +116,12 @@ class Migration(migrations.Migration):
|
|||
migrations.AddField(
|
||||
model_name='collection',
|
||||
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(
|
||||
model_name='collection',
|
||||
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(
|
||||
model_name='collection',
|
||||
|
@ -135,12 +131,12 @@ class Migration(migrations.Migration):
|
|||
migrations.AddField(
|
||||
model_name='collection',
|
||||
name='reagent',
|
||||
field=models.ForeignKey(to='processing.Reagent', blank=True, null=True),
|
||||
field=models.ForeignKey(blank=True, null=True, to='processing.Reagent'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='collection',
|
||||
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(
|
||||
model_name='collection',
|
||||
|
@ -155,4 +151,73 @@ class Migration(migrations.Migration):
|
|||
name='collection',
|
||||
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()
|
||||
|
||||
Project = apps.get_model('projects', 'Project')
|
||||
CollectionSpecies = apps.get_model('species', 'CollectionSpecies')
|
||||
|
||||
CollectionSpecies.objects.all().delete()
|
||||
|
||||
CollectionTypeForm = modelform_factory(CollectionType, fields='__all__')
|
||||
CollectionMethodForm = modelform_factory(CollectionMethod, fields='__all__')
|
||||
ADFGPermitForm = modelform_factory(ADFGPermit, 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;'):
|
||||
form = CollectionTypeForm(dict(name=r[1], code=r[2],
|
||||
|
@ -85,6 +89,15 @@ class Migration(migrations.Migration):
|
|||
else:
|
||||
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):
|
||||
CollectionType = apps.get_model('collections_ccdb', 'CollectionType')
|
||||
CollectionMethod = apps.get_model('collections_ccdb', 'CollectionMethod')
|
||||
|
@ -93,13 +106,15 @@ class Migration(migrations.Migration):
|
|||
Collection = apps.get_model('collections_ccdb', 'Collection')
|
||||
DatasheetAttachment = apps.get_model('collections_ccdb', 'DatasheetAttachment')
|
||||
CollectionTrap = apps.get_model('collections_ccdb', 'CollectionTrap')
|
||||
CollectionSpecies = apps.get_model('species', 'CollectionSpecies')
|
||||
|
||||
for model in [CollectionTrap, Collection, Flaw, DatasheetAttachment,
|
||||
CollectionMethod, CollectionType, ADFGPermit]:
|
||||
CollectionMethod, CollectionType, ADFGPermit, CollectionSpecies]:
|
||||
model.objects.all().delete()
|
||||
|
||||
dependencies = [
|
||||
('collections_ccdb', '0004_collections_ordering'),
|
||||
('collections_ccdb', '0001_initial'),
|
||||
('processing', '0002_DATA_initial'),
|
||||
]
|
||||
|
||||
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'),
|
||||
),
|
||||
]
|
Loading…
Add table
Add a link
Reference in a new issue