ccdb-api/ccdb/misc/migrations/0001_initial.py
Matthew Dillon 31a9f87848 Misc models
- measurement units
- measurement types
- containers
- materials
- colors
2016-01-28 12:51:55 -07:00

116 lines
4.9 KiB
Python

# -*- 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='Color',
fields=[
('id', models.AutoField(primary_key=True, serialize=False, auto_created=True, verbose_name='ID')),
('name', models.CharField(max_length=50)),
('code', models.CharField(blank=True, max_length=10)),
('color_number', models.FloatField(null=True, blank=True)),
('sort_order', models.IntegerField(null=True, blank=True)),
('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name')),
],
options={
'ordering': ['sort_order'],
},
),
migrations.CreateModel(
name='Container',
fields=[
('id', models.AutoField(primary_key=True, serialize=False, auto_created=True, verbose_name='ID')),
('name', models.CharField(max_length=100)),
('code', models.CharField(blank=True, max_length=10)),
('application', models.CharField(blank=True, max_length=50)),
('volume', models.FloatField(null=True, blank=True)),
('sort_order', models.IntegerField(null=True, blank=True)),
('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name')),
('color', models.ForeignKey(null=True, to='misc.Color', blank=True)),
],
options={
'ordering': ['sort_order'],
},
),
migrations.CreateModel(
name='Material',
fields=[
('id', models.AutoField(primary_key=True, serialize=False, auto_created=True, verbose_name='ID')),
('name', models.CharField(max_length=100)),
('code', models.CharField(blank=True, max_length=10)),
('material_class', models.CharField(blank=True, max_length=50)),
('description', models.CharField(blank=True, max_length=255)),
('sort_order', models.IntegerField(null=True, blank=True)),
('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name')),
],
options={
'ordering': ['sort_order'],
},
),
migrations.CreateModel(
name='MeasurementType',
fields=[
('id', models.AutoField(primary_key=True, serialize=False, auto_created=True, verbose_name='ID')),
('name', models.CharField(max_length=100)),
('code', models.CharField(blank=True, max_length=10)),
('measurement_type_class', models.CharField(blank=True, max_length=50)),
('description', models.CharField(blank=True, max_length=255)),
('sort_order', models.IntegerField(null=True, blank=True)),
('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name')),
],
options={
'ordering': ['sort_order'],
},
),
migrations.CreateModel(
name='MeasurementUnit',
fields=[
('id', models.AutoField(primary_key=True, serialize=False, auto_created=True, verbose_name='ID')),
('name', models.CharField(max_length=100)),
('code', models.CharField(max_length=25)),
('unit_class', models.CharField(blank=True, max_length=50)),
('description', models.CharField(blank=True, max_length=255)),
('sort_order', models.IntegerField(null=True, blank=True)),
('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name')),
],
options={
'ordering': ['sort_order'],
},
),
migrations.AlterUniqueTogether(
name='measurementunit',
unique_together=set([('name', 'code')]),
),
migrations.AddField(
model_name='measurementtype',
name='default_measurement_unit',
field=models.ForeignKey(null=True, to='misc.MeasurementUnit', blank=True),
),
migrations.AlterUniqueTogether(
name='material',
unique_together=set([('name', 'code')]),
),
migrations.AddField(
model_name='container',
name='material',
field=models.ForeignKey(null=True, to='misc.Material', blank=True),
),
migrations.AddField(
model_name='container',
name='measurement_unit',
field=models.ForeignKey(null=True, to='misc.MeasurementUnit', blank=True),
),
migrations.AlterUniqueTogether(
name='color',
unique_together=set([('name', 'code', 'color_number')]),
),
]