diff --git a/accounts/forms.py b/accounts/forms.py index e3bcd42..12d754d 100644 --- a/accounts/forms.py +++ b/accounts/forms.py @@ -1,7 +1,7 @@ from appsettings.settings import app_settings from django.contrib.auth import get_user_model from django.forms import ModelForm, ValidationError -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from .models import UserInstance, UserSSHKey from .utils import validate_ssh_key diff --git a/accounts/models.py b/accounts/models.py index 15e0ddf..1fcc880 100644 --- a/accounts/models.py +++ b/accounts/models.py @@ -1,7 +1,7 @@ from django.contrib.auth.models import User from django.core.validators import MinValueValidator from django.db import models -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from instances.models import Instance diff --git a/admin/forms.py b/admin/forms.py index c045edc..1a4a226 100644 --- a/admin/forms.py +++ b/admin/forms.py @@ -3,7 +3,7 @@ from django.contrib.auth.models import Group, User from django.contrib.auth.forms import ReadOnlyPasswordHashField from django.urls import reverse_lazy from django.utils.text import format_lazy -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from accounts.models import UserAttributes @@ -78,7 +78,7 @@ class UserForm(forms.ModelForm): label=_("Password"), help_text=format_lazy(_("""Raw passwords are not stored, so there is no way to see this user's password, but you can change the password using this form."""), - reverse_lazy('admin:user_update_password', + reverse_lazy('admin:user_update_password', args=[self.instance.id,])) ) self.fields['Password'] = password diff --git a/admin/views.py b/admin/views.py index bcadc0b..df2e354 100644 --- a/admin/views.py +++ b/admin/views.py @@ -5,7 +5,7 @@ from django.contrib.auth.forms import AdminPasswordChangeForm from django.contrib.auth.models import Group, User from django.core.paginator import Paginator from django.shortcuts import get_object_or_404, redirect, render -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from accounts.models import UserAttributes, UserInstance, Instance from appsettings.settings import app_settings diff --git a/appsettings/migrations/0002_auto_20200527_1603.py b/appsettings/migrations/0002_auto_20200527_1603.py index 2d698f7..f064c47 100644 --- a/appsettings/migrations/0002_auto_20200527_1603.py +++ b/appsettings/migrations/0002_auto_20200527_1603.py @@ -1,7 +1,8 @@ # Generated by Django 2.2.12 on 2020-05-23 12:05 from django.db import migrations -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ + def add_default_settings(apps, schema_editor): setting = apps.get_model("appsettings", "AppSettings") diff --git a/appsettings/migrations/0004_auto_20200716_0637.py b/appsettings/migrations/0004_auto_20200716_0637.py index 5feffa3..5593e83 100644 --- a/appsettings/migrations/0004_auto_20200716_0637.py +++ b/appsettings/migrations/0004_auto_20200716_0637.py @@ -1,7 +1,7 @@ # Generated by Django 2.2.13 on 2020-07-16 06:37 from django.db import migrations -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ def add_default_settings(apps, schema_editor): @@ -22,7 +22,7 @@ def del_default_settings(apps, schema_editor): setting.objects.using(db_alias).filter(key="CONSOLE_VIEW_ONLY").delete() setting.objects.using(db_alias).filter(key="CONSOLE_RESIZE_SESSION").delete() setting.objects.using(db_alias).filter(key="CONSOLE_CLIP_VIEWPORT").delete() - + class Migration(migrations.Migration): diff --git a/appsettings/models.py b/appsettings/models.py index 0d78231..a45827f 100644 --- a/appsettings/models.py +++ b/appsettings/models.py @@ -1,5 +1,6 @@ from django.db import models -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ + class AppSettings(models.Model): diff --git a/appsettings/views.py b/appsettings/views.py index 0b95cf8..07c6511 100644 --- a/appsettings/views.py +++ b/appsettings/views.py @@ -4,7 +4,7 @@ import os from django.shortcuts import render from django.http import HttpResponseRedirect from django.urls import reverse -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from django.contrib.auth.decorators import login_required from django.contrib import messages @@ -27,11 +27,11 @@ def appsettings(request): themes_list = os.listdir(sass_dir.value + "/wvc-theme") except FileNotFoundError as err: error_messages.append(err) - addlogmsg(request.user.username, "", err) + addlogmsg(request.user.username, "", err) # Bootstrap settings related with filesystems, because of that they are excluded from other settings appsettings = AppSettings.objects.exclude(description__startswith="Bootstrap").order_by("name") - + if request.method == 'POST': if 'SASS_DIR' in request.POST: @@ -44,23 +44,23 @@ def appsettings(request): except Exception as err: msg = err error_messages.append(msg) - + addlogmsg(request.user.username, "", msg) return HttpResponseRedirect(request.get_full_path()) if 'BOOTSTRAP_THEME' in request.POST: theme = request.POST.get("BOOTSTRAP_THEME", "") scss_var = f"@import '{sass_dir.value}/wvc-theme/{theme}/variables';" - scss_bootswatch = f"@import '{sass_dir.value}/wvc-theme/{theme}/bootswatch';" + scss_bootswatch = f"@import '{sass_dir.value}/wvc-theme/{theme}/bootswatch';" scss_boot = f"@import '{sass_dir.value}/bootstrap-overrides.scss';" - try: + try: with open(sass_dir.value + "/wvc-main.scss", "w") as main: main.write(scss_var + "\n" + scss_boot + "\n" + scss_bootswatch + "\n") - + css_compressed = sass.compile(string=scss_var + "\n"+ scss_boot + "\n" + scss_bootswatch, output_style='compressed') with open("static/css/" + main_css, "w") as css: - css.write(css_compressed) + css.write(css_compressed) bootstrap_theme.value = theme bootstrap_theme.save() @@ -70,7 +70,7 @@ def appsettings(request): except Exception as err: msg = err error_messages.append(msg) - + addlogmsg(request.user.username, "", msg) return HttpResponseRedirect(request.get_full_path()) @@ -85,9 +85,8 @@ def appsettings(request): except Exception as err: msg = err error_messages.append(msg) - + addlogmsg(request.user.username, "", msg) return HttpResponseRedirect(request.get_full_path()) return render(request, 'appsettings.html', locals()) - diff --git a/computes/forms.py b/computes/forms.py index 5006766..e77be30 100644 --- a/computes/forms.py +++ b/computes/forms.py @@ -1,6 +1,6 @@ import re from django import forms -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from computes.models import Compute from vrtManager.connection import CONN_TCP, CONN_SSH, CONN_TLS, CONN_SOCKET from .validators import validate_hostname diff --git a/computes/models.py b/computes/models.py index 56cb22b..b1c3cd1 100644 --- a/computes/models.py +++ b/computes/models.py @@ -1,6 +1,6 @@ from django.db.models import CharField, IntegerField, Model from django.utils.functional import cached_property -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from libvirt import virConnect from vrtManager.connection import connection_manager diff --git a/computes/validators.py b/computes/validators.py index 67f7c40..e58dfea 100644 --- a/computes/validators.py +++ b/computes/validators.py @@ -1,6 +1,6 @@ from django.core.exceptions import ValidationError -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ import re have_symbol = re.compile('[^a-zA-Z0-9._-]+') diff --git a/instances/forms.py b/instances/forms.py index 633ecd2..85b7584 100644 --- a/instances/forms.py +++ b/instances/forms.py @@ -1,7 +1,7 @@ import re from django import forms -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from appsettings.models import AppSettings from webvirtcloud.settings import QEMU_CONSOLE_LISTEN_ADDRESSES, QEMU_KEYMAPS diff --git a/instances/models.py b/instances/models.py index 563a5e1..ef95154 100644 --- a/instances/models.py +++ b/instances/models.py @@ -1,6 +1,6 @@ from django.db import models from django.utils.functional import cached_property -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from libvirt import VIR_DOMAIN_XML_SECURE from computes.models import Compute diff --git a/instances/utils.py b/instances/utils.py index c1497a8..e6be97d 100644 --- a/instances/utils.py +++ b/instances/utils.py @@ -5,7 +5,7 @@ from collections import OrderedDict from django.conf import settings from django.contrib.auth.models import User -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from accounts.models import UserInstance from appsettings.settings import app_settings diff --git a/instances/views.py b/instances/views.py index 6f6c4d7..871a1cb 100644 --- a/instances/views.py +++ b/instances/views.py @@ -18,7 +18,7 @@ from django.contrib.auth.models import User from django.http import Http404, HttpResponse, JsonResponse from django.shortcuts import get_object_or_404, redirect, render from django.urls import reverse -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from libvirt import (VIR_DOMAIN_UNDEFINE_KEEP_NVRAM, VIR_DOMAIN_UNDEFINE_NVRAM, libvirtError) from logs.views import addlogmsg from vrtManager import util @@ -973,7 +973,7 @@ def set_qos(request, pk): messages.success( request, _("%(qos_dir)s QoS is set. Network XML is changed. \ - Stop and start network to activate new config.") % {'qos_dir': qos_dir.capitalize()}) + Stop and start network to activate new config." ) % {'qos_dir': qos_dir.capitalize()}) return redirect(request.META.get('HTTP_REFERER') + '#network') @@ -991,7 +991,7 @@ def unset_qos(request, pk): messages.success( request, _("%(qos_dir)s QoS is deleted. Network XML is changed. \ - Stop and start network to activate new config.") % {'qos_dir': qos_dir.capitalize()}) + Stop and start network to activate new config." ) % {'qos_dir': qos_dir.capitalize()}) return redirect(request.META.get('HTTP_REFERER') + '#network') diff --git a/interfaces/forms.py b/interfaces/forms.py index 8767f5c..4490d0b 100644 --- a/interfaces/forms.py +++ b/interfaces/forms.py @@ -1,6 +1,6 @@ import re from django import forms -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ class AddInterface(forms.Form): diff --git a/logs/models.py b/logs/models.py index 8302030..d45c056 100644 --- a/logs/models.py +++ b/logs/models.py @@ -1,5 +1,5 @@ from django.db.models import Model, CharField, DateTimeField -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ class Logs(Model): diff --git a/networks/forms.py b/networks/forms.py index 82d71a0..6b9189f 100644 --- a/networks/forms.py +++ b/networks/forms.py @@ -1,6 +1,6 @@ import re from django import forms -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ class AddNetPool(forms.Form): diff --git a/networks/views.py b/networks/views.py index 9072636..917cb6f 100644 --- a/networks/views.py +++ b/networks/views.py @@ -2,7 +2,7 @@ from django.contrib import messages from django.http import HttpResponseRedirect from django.shortcuts import get_object_or_404, render from django.urls import reverse -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from libvirt import libvirtError from admin.decorators import superuser_only @@ -212,7 +212,7 @@ def network(request, compute_id, pool): conn.set_qos(qos_dir, average, peak, burst) if conn.is_active(): messages.success( - request, + request, _(f"{qos_dir.capitalize()} QoS is set. Network XML is changed.") + _("Stop and start network to activate new config")) else: @@ -226,7 +226,7 @@ def network(request, compute_id, pool): if conn.is_active(): messages.success( - request, + request, _(f"{qos_dir.capitalize()} QoS is deleted. Network XML is changed. ") + _("Stop and start network to activate new config.")) else: diff --git a/nwfilters/views.py b/nwfilters/views.py index 982a9b5..6fdef30 100644 --- a/nwfilters/views.py +++ b/nwfilters/views.py @@ -1,7 +1,7 @@ from django.http import HttpResponseRedirect from django.shortcuts import get_object_or_404, render from django.urls import reverse -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from libvirt import libvirtError from admin.decorators import superuser_only diff --git a/storages/forms.py b/storages/forms.py index eea9bb4..f2fd89b 100644 --- a/storages/forms.py +++ b/storages/forms.py @@ -1,6 +1,6 @@ import re from django import forms -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ class AddStgPool(forms.Form): diff --git a/storages/views.py b/storages/views.py index 9f3f0fe..2d70be2 100644 --- a/storages/views.py +++ b/storages/views.py @@ -4,7 +4,7 @@ from django.contrib import messages from django.http import HttpResponse, HttpResponseRedirect from django.shortcuts import get_object_or_404, redirect, render from django.urls import reverse -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from libvirt import libvirtError from admin.decorators import superuser_only diff --git a/webvirtcloud/middleware.py b/webvirtcloud/middleware.py index 5ca2940..6759ff1 100644 --- a/webvirtcloud/middleware.py +++ b/webvirtcloud/middleware.py @@ -1,6 +1,6 @@ from django.contrib import messages from django.shortcuts import render -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from libvirt import libvirtError