mirror of
https://github.com/retspen/webvirtcloud
synced 2024-12-25 07:35:22 +00:00
Merge pull request #369 from Real-Gecko/master
replaced ugettext_lazy with gettext_lazy
This commit is contained in:
commit
9e56378682
23 changed files with 40 additions and 39 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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 <a href='{}'>this form</a>."""),
|
||||
reverse_lazy('admin:user_update_password',
|
||||
reverse_lazy('admin:user_update_password',
|
||||
args=[self.instance.id,]))
|
||||
)
|
||||
self.fields['Password'] = password
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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):
|
||||
|
||||
|
|
|
@ -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):
|
||||
|
||||
|
|
|
@ -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())
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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._-]+')
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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')
|
||||
|
||||
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue