1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2024-12-27 08:35:22 +00:00
webvirtcloud/appsettings/migrations/0010_auto_20231030_1305.py
2023-11-01 18:08:38 -04:00

28 lines
962 B
Python

# Generated by Django 4.2.5 on 2023-10-30 17:05
from django.db import migrations
from django.utils.translation import gettext_lazy as _
def add_default_settings(apps, schema_editor):
setting = apps.get_model("appsettings", "AppSettings")
db_alias = schema_editor.connection.alias
setting.objects.using(db_alias).bulk_create([
setting(35, _("VM NIC Type"), "INSTANCE_NIC_DEFAULT_TYPE", "default", "default,e1000,e1000e,rt18139,virtio", _("Change instance default NIC type"))
])
def del_default_settings(apps, schema_editor):
setting = apps.get_model("appsettings", "AppSettings")
db_alias = schema_editor.connection.alias
setting.objects.using(db_alias).filter(key="INSTANCE_NIC_DEFAULT_TYPE").delete()
class Migration(migrations.Migration):
dependencies = [
('appsettings', '0009_alter_appsettings_id')
]
operations = [
migrations.RunPython(add_default_settings,del_default_settings)
]