-
Notifications
You must be signed in to change notification settings - Fork 370
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #620 from MisterBlueBear/global_setting_nic_type
Global setting for NIC type
- Loading branch information
Showing
4 changed files
with
50 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 4.2.5 on 2023-10-30 17:00 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('appsettings', '0008_auto_20220905_1459'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='appsettings', | ||
name='id', | ||
field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# 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) | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters