71 lines
3.8 KiB
Python
71 lines
3.8 KiB
Python
# -*- coding: utf-8 -*-
|
|
# Generated by Django 1.10.5 on 2021-04-22 11:09
|
|
from __future__ import unicode_literals
|
|
|
|
from django.conf import settings
|
|
from django.db import migrations, models
|
|
import django.db.models.deletion
|
|
import orchestra.core.validators
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
|
('services', '0001_initial'),
|
|
]
|
|
|
|
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')),
|
|
],
|
|
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')),
|
|
],
|
|
),
|
|
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')),
|
|
('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')),
|
|
],
|
|
),
|
|
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'),
|
|
),
|
|
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'),
|
|
),
|
|
]
|