From b7cd731fda1d4c11732db631e62e401b3d4dc462 Mon Sep 17 00:00:00 2001 From: "Ing. Jan KRCMAR" Date: Thu, 5 Oct 2017 08:08:04 +0200 Subject: [PATCH] UserAttributes.default_instances moved to django.conf.settings.NEW_USER_DEFAULT_INSTANCES --- accounts/models.py | 10 ++-------- webvirtcloud/settings.py | 5 +++++ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/accounts/models.py b/accounts/models.py index 0ddf450..19e3a20 100644 --- a/accounts/models.py +++ b/accounts/models.py @@ -1,5 +1,6 @@ from django.db import models from django.contrib.auth.models import User +from django.conf import settings from instances.models import Instance @@ -30,13 +31,6 @@ class UserAttributes(models.Model): max_memory = models.IntegerField(default=2048) max_disk_size = models.IntegerField(default=20) - default_instances = [ - 'debian8-template', - 'debian8-template-nocf', - 'debian9-template', - 'debian9-template-nocf', - ] - @staticmethod def create_missing_userattributes(user): try: @@ -49,7 +43,7 @@ class UserAttributes(models.Model): def add_default_instances(user): existing_instances = UserInstance.objects.filter(user=user) if not existing_instances: - for instance_name in UserAttributes.default_instances: + for instance_name in settings.NEW_USER_DEFAULT_INSTANCES: instance = Instance.objects.get(name=instance_name) user_instance = UserInstance(user=user, instance=instance) user_instance.save() diff --git a/webvirtcloud/settings.py b/webvirtcloud/settings.py index 1f87d20..5a9a7f2 100644 --- a/webvirtcloud/settings.py +++ b/webvirtcloud/settings.py @@ -117,6 +117,11 @@ LIBVIRT_KEEPALIVE_INTERVAL = 5 LIBVIRT_KEEPALIVE_COUNT = 5 ALLOW_INSTANCE_MULTIPLE_OWNER = True +NEW_USER_DEFAULT_INSTANCES = [ + 'debian8-template', + 'debian9-template', + 'kiv-adm-template', +] CLONE_INSTANCE_DEFAULT_PREFIX = 'ourea' LOGS_PER_PAGE = 100 QUOTA_DEBUG = True