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

71 lines
3.8 KiB
Python
Raw Permalink Normal View History

2015-04-08 14:41:09 +00:00
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2021-04-22 11:09
2015-04-08 14:41:09 +00:00
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
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 = [
2015-04-29 13:55:22 +00:00
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('services', '0001_initial'),
2015-04-08 14:41:09 +00:00
]
operations = [
migrations.CreateModel(
name='ContractedPlan',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='plans', to=settings.AUTH_USER_MODEL, verbose_name='account')),
2015-04-08 14:41:09 +00:00
],
options={
'verbose_name_plural': 'plans',
},
),
migrations.CreateModel(
name='Plan',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=32, unique=True, validators=[orchestra.core.validators.validate_name], verbose_name='name')),
('verbose_name', models.CharField(blank=True, max_length=128, verbose_name='verbose_name')),
('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=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('quantity', models.PositiveIntegerField(blank=True, help_text='See rate algorihm help text.', null=True, verbose_name='quantity')),
2015-04-29 14:32:38 +00:00
('price', models.DecimalField(decimal_places=2, max_digits=12, verbose_name='price')),
('plan', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='rates', to='plans.Plan', verbose_name='plan')),
('service', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='rates', to='services.Service', verbose_name='service')),
2015-04-08 14:41:09 +00:00
],
),
migrations.AddField(
model_name='contractedplan',
name='plan',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='contracts', to='plans.Plan', verbose_name='plan'),
2015-04-08 14:41:09 +00:00
),
migrations.AlterUniqueTogether(
name='rate',
unique_together=set([('service', 'plan', 'quantity')]),
),
migrations.AlterField(
model_name='rate',
name='plan',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='rates', to='plans.Plan', verbose_name='plan'),
),
migrations.AlterField(
model_name='rate',
name='plan',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='rates', to='plans.Plan', verbose_name='plan'),
),
2015-04-08 14:41:09 +00:00
]