mirror of
https://github.com/retspen/webvirtcloud
synced 2024-12-25 15:45:23 +00:00
28 lines
962 B
Python
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)
|
|
]
|