django-orchestra-test/orchestra/contrib/plans/migrations/0001_initial.py

59 lines
3 KiB
Python
Raw Normal View History

2015-04-08 14:41:09 +00:00
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
2015-04-29 13:55:22 +00:00
import orchestra.core.validators
2015-04-29 14:32:38 +00:00
from django.conf import settings
2015-04-08 14:41:09 +00:00
class Migration(migrations.Migration):
dependencies = [
2015-04-29 14:32:38 +00:00
('services', '0001_initial'),
2015-04-29 13:55:22 +00:00
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
2015-04-08 14:41:09 +00:00
]
operations = [
migrations.CreateModel(
name='ContractedPlan',
fields=[
2015-04-29 14:32:38 +00:00
('id', models.AutoField(primary_key=True, auto_created=True, serialize=False, verbose_name='ID')),
('account', models.ForeignKey(to=settings.AUTH_USER_MODEL, related_name='plans', verbose_name='account')),
2015-04-08 14:41:09 +00:00
],
options={
'verbose_name_plural': 'plans',
},
),
migrations.CreateModel(
name='Plan',
fields=[
2015-04-29 14:32:38 +00:00
('id', models.AutoField(primary_key=True, auto_created=True, serialize=False, verbose_name='ID')),
('name', models.CharField(validators=[orchestra.core.validators.validate_name], verbose_name='name', unique=True, max_length=32)),
('verbose_name', models.CharField(blank=True, verbose_name='verbose_name', max_length=128)),
('is_active', models.BooleanField(help_text='Designates whether this account should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active', default=True)),
('is_default', models.BooleanField(help_text='Designates whether this plan is used by default or not.', verbose_name='default', default=False)),
('is_combinable', models.BooleanField(help_text='Designates whether this plan can be combined with other plans or not.', verbose_name='combinable', default=True)),
('allow_multiple', models.BooleanField(help_text='Designates whether this plan allow for multiple contractions.', verbose_name='allow multiple', default=False)),
2015-04-08 14:41:09 +00:00
],
),
migrations.CreateModel(
name='Rate',
fields=[
2015-04-29 14:32:38 +00:00
('id', models.AutoField(primary_key=True, auto_created=True, serialize=False, verbose_name='ID')),
('quantity', models.PositiveIntegerField(help_text='See rate algorihm help text.', blank=True, verbose_name='quantity', null=True)),
('price', models.DecimalField(decimal_places=2, max_digits=12, verbose_name='price')),
('plan', models.ForeignKey(to='plans.Plan', related_name='rates', verbose_name='plan')),
('service', models.ForeignKey(to='services.Service', related_name='rates', verbose_name='service')),
2015-04-08 14:41:09 +00:00
],
),
migrations.AddField(
model_name='contractedplan',
name='plan',
2015-04-29 14:32:38 +00:00
field=models.ForeignKey(to='plans.Plan', related_name='contracts', verbose_name='plan'),
2015-04-08 14:41:09 +00:00
),
migrations.AlterUniqueTogether(
name='rate',
unique_together=set([('service', 'plan', 'quantity')]),
),
]