Remove initial VMPricing code from migration

This commit is contained in:
PCoder 2018-04-12 07:59:04 +02:00
parent 1116812a99
commit 588f513f2a
2 changed files with 1 additions and 49 deletions

View file

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2018-04-09 19:23
# Generated by Django 1.9.4 on 2018-04-10 19:48
from __future__ import unicode_literals
from django.db import migrations, models

View file

@ -1,48 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2018-04-09 19:28
from __future__ import unicode_literals
from django.db import migrations
DEFAULT_VMPRICING_NAME='default'
def create_default_pricing(apps, schema_editor):
"""
Create default pricing
:param apps:
:param schema_editor:
:return:
"""
VMPricing = apps.get_model('datacenterlight', 'VMPricing')
if not VMPricing.objects.count():
vm_pricing = VMPricing(
name=DEFAULT_VMPRICING_NAME,
vat_inclusive=True,
cores_unit_price=5,
ram_unit_price=2,
ssd_unit_price=0.6,
hdd_unit_price=0.01,
)
vm_pricing.save()
def undo_vm_pricing(apps, schema_editor):
"""Deleting all entries for this model"""
VMPricing = apps.get_model("datacenterlight", "VMPricing")
VMPricing.objects.all().delete()
class Migration(migrations.Migration):
dependencies = [
('datacenterlight', '0019_auto_20180409_1923'),
]
operations = [
migrations.RunPython(
create_default_pricing,
reverse_code=undo_vm_pricing
),
]