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

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