From e46bb99b3b8c624eed642c4d3e64191e69f18a07 Mon Sep 17 00:00:00 2001 From: catborise Date: Thu, 4 Jun 2020 15:22:55 +0300 Subject: [PATCH] fix typos and rearrange imports & add new lines EOF --- accounts/templates/profile.html | 1 - accounts/views.py | 4 +--- admin/templates/admin/common/list.html | 10 +++++----- admin/views.py | 2 +- appsettings/migrations/0002_auto_20200527_1603.py | 2 +- computes/templates/create_comp_block.html | 2 +- computes/urls.py | 2 +- create/views.py | 10 +++++----- instances/templates/allinstances_index_nongrouped.html | 2 +- instances/templates/bottom_bar.html | 2 +- logs/views.py | 2 -- nwfilters/models.py | 3 --- secrets/views.py | 2 +- static/css/webvirtcloud.css | 2 +- storages/views.py | 9 +++++---- templates/403.html | 2 +- webvirtcloud/settings.py.template | 3 ++- 17 files changed, 27 insertions(+), 33 deletions(-) diff --git a/accounts/templates/profile.html b/accounts/templates/profile.html index fb2beaa..92b0ef6 100644 --- a/accounts/templates/profile.html +++ b/accounts/templates/profile.html @@ -115,4 +115,3 @@ {% endblock %} - diff --git a/accounts/views.py b/accounts/views.py index 0239f4c..9b8d5a1 100644 --- a/accounts/views.py +++ b/accounts/views.py @@ -1,4 +1,3 @@ -from django.conf import settings from django.core.validators import ValidationError from django.http import HttpResponseRedirect from django.shortcuts import render @@ -22,7 +21,6 @@ def profile(request): error_messages = [] # user = User.objects.get(id=request.user.id) publickeys = UserSSHKey.objects.filter(user_id=request.user.id) - themes_list = os.listdir(settings.SCSS_DIR +"/wvc-theme") if request.method == 'POST': if 'username' in request.POST: @@ -104,7 +102,7 @@ def account(request, user_id): return HttpResponseRedirect(request.get_full_path()) if 'add' in request.POST: inst_id = request.POST.get('inst_id', '') - + if AppSettings.objects.get(key="ALLOW_INSTANCE_MULTIPLE_OWNER").value == 'True': check_inst = UserInstance.objects.filter(instance_id=int(inst_id), user_id=int(user_id)) else: diff --git a/admin/templates/admin/common/list.html b/admin/templates/admin/common/list.html index 7292f65..8d76c0b 100644 --- a/admin/templates/admin/common/list.html +++ b/admin/templates/admin/common/list.html @@ -6,18 +6,18 @@ {% block content %} {% if create_url %} -{% icon 'plus' %} {%trans "Create New" %} + {% icon 'plus' %} {%trans "Create New" %} {% endif %} - +
{% for object in object_list %}
{{ object }}
{% icon 'edit' %} {%trans "Edit"%} {% if extra_urls %} - {% for url in extra_urls %} - {{ url.1 }} - {% endfor %} + {% for url in extra_urls %} + {{ url.1 }} + {% endfor %} {% endif %} {% icon 'times' %} {%trans "Delete" %}
diff --git a/admin/views.py b/admin/views.py index f6c47cd..a7fbed9 100644 --- a/admin/views.py +++ b/admin/views.py @@ -4,7 +4,7 @@ from django.shortcuts import get_object_or_404, redirect, render from django.utils.translation import ugettext_lazy as _ from accounts.models import UserAttributes -from appsettings.views import AppSettings +from appsettings.models import AppSettings from logs.models import Logs from . import forms diff --git a/appsettings/migrations/0002_auto_20200527_1603.py b/appsettings/migrations/0002_auto_20200527_1603.py index 9e5a083..5a94432 100644 --- a/appsettings/migrations/0002_auto_20200527_1603.py +++ b/appsettings/migrations/0002_auto_20200527_1603.py @@ -102,4 +102,4 @@ class Migration(migrations.Migration): operations = [ migrations.RunPython(add_default_settings, del_default_settings), - ] \ No newline at end of file + ] diff --git a/computes/templates/create_comp_block.html b/computes/templates/create_comp_block.html index 4f6797f..b552d67 100644 --- a/computes/templates/create_comp_block.html +++ b/computes/templates/create_comp_block.html @@ -1,7 +1,7 @@ {% load i18n %} {% load bootstrap4 %} {% load font_awesome %} -
+
{% trans "TCP" %} {% trans "SSH" %} {% trans "TLS" %} diff --git a/computes/urls.py b/computes/urls.py index 55013e1..dd66532 100644 --- a/computes/urls.py +++ b/computes/urls.py @@ -1,6 +1,7 @@ from django.urls import path, include from . import views +from . import forms from create.views import create_instance, create_instance_select_type from instances.views import instances from interfaces.views import interface, interfaces @@ -8,7 +9,6 @@ from networks.views import network, networks from nwfilters.views import nwfilter, nwfilters from secrets.views import secrets from storages.views import get_volumes, storage, storages -from . import forms urlpatterns = [ path('', views.computes, name='computes'), diff --git a/create/views.py b/create/views.py index 5b2b6c6..0518ab5 100644 --- a/create/views.py +++ b/create/views.py @@ -205,11 +205,11 @@ def create_instance(request, compute_id, arch, machine): error_messages.append(error_msg) else: clone_path = conn.clone_from_template( - data['name'], - templ_path, - data['storage'], - meta_prealloc, - default_disk_owner_uid, + data['name'], + templ_path, + data['storage'], + meta_prealloc, + default_disk_owner_uid, default_disk_owner_gid) volume = dict() volume['path'] = clone_path diff --git a/instances/templates/allinstances_index_nongrouped.html b/instances/templates/allinstances_index_nongrouped.html index 8c248a5..76dad7b 100644 --- a/instances/templates/allinstances_index_nongrouped.html +++ b/instances/templates/allinstances_index_nongrouped.html @@ -1,5 +1,5 @@ {% load i18n %} - +
diff --git a/instances/templates/bottom_bar.html b/instances/templates/bottom_bar.html index 45cd1eb..040af6c 100644 --- a/instances/templates/bottom_bar.html +++ b/instances/templates/bottom_bar.html @@ -22,4 +22,4 @@ - \ No newline at end of file + diff --git a/logs/views.py b/logs/views.py index 06f0d90..7e98221 100644 --- a/logs/views.py +++ b/logs/views.py @@ -1,12 +1,10 @@ import json -from django.conf import settings from django.http import HttpResponse, HttpResponseRedirect from django.shortcuts import render from django.urls import reverse from admin.decorators import superuser_only -from appsettings.models import AppSettings from instances.models import Instance from logs.models import Logs diff --git a/nwfilters/models.py b/nwfilters/models.py index 1dfab76..71a8362 100644 --- a/nwfilters/models.py +++ b/nwfilters/models.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - from django.db import models # Create your models here. diff --git a/secrets/views.py b/secrets/views.py index 99a7f1f..9b47f18 100644 --- a/secrets/views.py +++ b/secrets/views.py @@ -79,4 +79,4 @@ def secrets(request, compute_id): except libvirtError as err: error_messages.append(err) - return render(request, 'secrets.html', locals()) \ No newline at end of file + return render(request, 'secrets.html', locals()) diff --git a/static/css/webvirtcloud.css b/static/css/webvirtcloud.css index 3cb9671..81a99c2 100644 --- a/static/css/webvirtcloud.css +++ b/static/css/webvirtcloud.css @@ -7,7 +7,7 @@ /* Global Styles */ body { - padding-bottom: 40px; + padding-bottom: 50px; } .container { diff --git a/storages/views.py b/storages/views.py index b47528e..6411fde 100644 --- a/storages/views.py +++ b/storages/views.py @@ -1,15 +1,16 @@ import json -from django.shortcuts import render, get_object_or_404 +from django.contrib import messages from django.http import HttpResponseRedirect, HttpResponse +from django.shortcuts import render, get_object_or_404 from django.utils.translation import ugettext_lazy as _ from django.urls import reverse +from libvirt import libvirtError + +from admin.decorators import superuser_only from computes.models import Compute from appsettings.models import AppSettings from storages.forms import AddStgPool, AddImage, CloneImage from vrtManager.storage import wvmStorage, wvmStorages -from libvirt import libvirtError -from django.contrib import messages -from admin.decorators import superuser_only @superuser_only diff --git a/templates/403.html b/templates/403.html index 64187ec..4b320b4 100644 --- a/templates/403.html +++ b/templates/403.html @@ -1,6 +1,6 @@ {% extends "base_auth.html" %} {% load i18n %} -{% block title %}{% trans "404" %}{% endblock %} +{% block title %}{% trans "403" %}{% endblock %} {% block content %}
diff --git a/webvirtcloud/settings.py.template b/webvirtcloud/settings.py.template index 10bb122..dc23517 100644 --- a/webvirtcloud/settings.py.template +++ b/webvirtcloud/settings.py.template @@ -25,6 +25,7 @@ INSTALLED_APPS = [ 'fa', 'accounts', 'admin', + 'appsettings', 'computes', 'console', 'create', @@ -35,7 +36,6 @@ INSTALLED_APPS = [ 'nwfilters', 'storages', 'secrets', - 'appsettings', 'logs', ] @@ -164,5 +164,6 @@ QEMU_KEYMAPS = ['ar', 'da', 'de', 'de-ch', 'en-gb', 'en-us', 'es', 'et', 'fi', LIBVIRT_KEEPALIVE_INTERVAL = 5 LIBVIRT_KEEPALIVE_COUNT = 5 +ALLOW_EMPTY_PASSWORD = False NEW_USER_DEFAULT_INSTANCES = [] SHOW_PROFILE_EDIT_PASSWORD = True
{% trans "Name" %}
{% trans "Description" %}