diff --git a/instances/forms.py b/instances/forms.py index 5e8f5a40..a96058e9 100644 --- a/instances/forms.py +++ b/instances/forms.py @@ -3,7 +3,6 @@ import re from django import forms from django.conf import settings from django.utils.translation import gettext_lazy as _ -from webvirtcloud.settings import QEMU_CONSOLE_LISTENER_ADDRESSES, QEMU_KEYMAPS from .models import CreateInstance, Flavor from .utils import nic_macs @@ -62,11 +61,11 @@ class ConsoleForm(forms.Form): if "pty" in (instance.config_console_type, self.data.get("console_type")): del self.fields["password_action"], self.fields["password"] return - keymap_choices = [("auto", _("Auto"))] + list((c, c) for c in QEMU_KEYMAPS) + keymap_choices = [("auto", _("Auto"))] + list((c, c) for c in settings.QEMU_KEYMAPS) # Only administrators choose the listen address: beyond localhost the # console is reachable from the network. A disabled field ignores # posted values. - listeners = list(QEMU_CONSOLE_LISTENER_ADDRESSES) + listeners = list(settings.QEMU_CONSOLE_LISTENER_ADDRESSES) # an address set elsewhere (the XML editor) is offered, so a save keeps it if listener and listener not in dict(listeners): listeners.append((listener, listener)) diff --git a/instances/models.py b/instances/models.py index 864e67d0..4651dee2 100644 --- a/instances/models.py +++ b/instances/models.py @@ -1,4 +1,5 @@ from computes.models import Compute +from django.conf import settings from django.core.validators import MinValueValidator from django.db import models from django.utils.functional import cached_property @@ -11,7 +12,6 @@ from libvirt import ( from operations import claims from operations.models import Claim from vrtManager.instance import PERSISTENT_XML, wvmInstance -from webvirtcloud.settings import QEMU_CONSOLE_LISTENER_ADDRESSES class Flavor(models.Model): @@ -466,7 +466,7 @@ class CreateInstance(models.Model): max_length=16, error_messages={"required": _("Please select a video driver")} ) listener_addr = models.CharField( - max_length=20, choices=QEMU_CONSOLE_LISTENER_ADDRESSES + max_length=20, choices=settings.QEMU_CONSOLE_LISTENER_ADDRESSES ) class Meta: diff --git a/webvirtcloud/urls.py b/webvirtcloud/urls.py index 6a00af67..5c98e352 100644 --- a/webvirtcloud/urls.py +++ b/webvirtcloud/urls.py @@ -9,17 +9,6 @@ from appsettings.views import appsettings from console.views import console from instances.views import index -# Fallback for existing installations where REST_FRAMEWORK.DEFAULT_SCHEMA_CLASS is not configured in settings.py -user_rf = getattr(settings, "REST_FRAMEWORK", None) -if not user_rf or "DEFAULT_SCHEMA_CLASS" not in user_rf: - try: - from rest_framework.settings import api_settings - from drf_spectacular.openapi import AutoSchema - - api_settings.DEFAULT_SCHEMA_CLASS = AutoSchema - except (ImportError, AttributeError): - pass - urlpatterns = [ path("", index, name="index"), path("admin/", include(("admin.urls", "admin"), namespace="admin")),