diff --git a/accounts/forms.py b/accounts/forms.py index a98767b..2e04118 100644 --- a/accounts/forms.py +++ b/accounts/forms.py @@ -7,7 +7,7 @@ from django.conf import settings class UserAddForm(forms.Form): name = forms.CharField(label="Name", - error_messages={'required': _('No User name has been entered')}, + error_messages={'required': _('No username has been entered')}, max_length=20) password = forms.CharField(required=not settings.ALLOW_EMPTY_PASSWORD, error_messages={'required': _('No password has been entered')},) diff --git a/accounts/models.py b/accounts/models.py index 759455c..0f96879 100644 --- a/accounts/models.py +++ b/accounts/models.py @@ -19,8 +19,8 @@ class UserInstance(models.Model): class UserSSHKey(models.Model): user = models.ForeignKey(User, on_delete=models.DO_NOTHING) - keyname = models.CharField(max_length=25) - keypublic = models.CharField(max_length=500) + keyname = models.CharField(_('key name'), max_length=25) + keypublic = models.CharField(_('public key'), max_length=500) def __unicode__(self): return self.keyname @@ -29,24 +29,28 @@ class UserSSHKey(models.Model): class UserAttributes(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) can_clone_instances = models.BooleanField(default=True) - max_instances = models.IntegerField(default=2, - help_text="-1 for unlimited. Any integer value", + max_instances = models.IntegerField(_('max instances'), + default=2, + help_text=_("-1 for unlimited. Any integer value"), validators=[ MinValueValidator(-1), ]) max_cpus = models.IntegerField( + _('max CPUs'), default=2, - help_text="-1 for unlimited. Any integer value", + help_text=_("-1 for unlimited. Any integer value"), validators=[MinValueValidator(-1)], ) max_memory = models.IntegerField( + _('max memory'), default=2048, - help_text="-1 for unlimited. Any integer value", + help_text=_("-1 for unlimited. Any integer value"), validators=[MinValueValidator(-1)], ) max_disk_size = models.IntegerField( + _('max disk size'), default=20, - help_text="-1 for unlimited. Any integer value", + help_text=_("-1 for unlimited. Any integer value"), validators=[MinValueValidator(-1)], ) diff --git a/accounts/templates/accounts-list.html b/accounts/templates/accounts-list.html index b9c3487..f34afd8 100644 --- a/accounts/templates/accounts-list.html +++ b/accounts/templates/accounts-list.html @@ -8,7 +8,7 @@
{% include 'create_user_block.html' %}
@@ -22,7 +22,7 @@
- {% trans "Warning" %}: {% trans "You don't have any User" %} + {% trans "Warning" %}: {% trans "You don't have any user" %}
{% else %} diff --git a/accounts/templates/accounts.html b/accounts/templates/accounts.html index 68b64d9..0164d43 100644 --- a/accounts/templates/accounts.html +++ b/accounts/templates/accounts.html @@ -18,7 +18,7 @@
- {% trans "Warning" %}: {% trans "You don't have any User" %} + {% trans "Warning" %}: {% trans "You don't have any user" %}
{% else %} diff --git a/accounts/templates/create_user_block.html b/accounts/templates/create_user_block.html index 5042bfe..dafc071 100644 --- a/accounts/templates/create_user_block.html +++ b/accounts/templates/create_user_block.html @@ -17,7 +17,7 @@
- +
diff --git a/admin/migrations/0001_initial.py b/admin/migrations/0001_initial.py index 9a54081..e558854 100644 --- a/admin/migrations/0001_initial.py +++ b/admin/migrations/0001_initial.py @@ -9,7 +9,6 @@ class Migration(migrations.Migration): initial = True dependencies = [ - ('auth', '0011_update_proxy_permissions'), ] operations = [ diff --git a/admin/migrations/0002_auto_20200609_0830.py b/admin/migrations/0002_auto_20200609_0830.py new file mode 100644 index 0000000..012a070 --- /dev/null +++ b/admin/migrations/0002_auto_20200609_0830.py @@ -0,0 +1,14 @@ +# Generated by Django 2.2.12 on 2020-06-09 08:30 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('admin', '0001_initial'), + ('auth', '0011_update_proxy_permissions'), + ] + + operations = [ + ] diff --git a/admin/templates/admin/user_list.html b/admin/templates/admin/user_list.html index 9553187..03863ef 100644 --- a/admin/templates/admin/user_list.html +++ b/admin/templates/admin/user_list.html @@ -22,7 +22,7 @@
- {% icon 'exclamation-triangle '%} {% trans "Warning" %}: {% trans "You don't have any users" %} + {% icon 'exclamation-triangle '%} {% trans "Warning" %}: {% trans "You don't have any user" %}
{% else %} @@ -35,7 +35,7 @@ {% trans "Staff" %} {% trans "Superuser" %} {% trans "Can Clone" %} - {% trans "" %} + {% trans "Actions" %} diff --git a/appsettings/migrations/0002_auto_20200527_1603.py b/appsettings/migrations/0002_auto_20200527_1603.py index 5a94432..2d698f7 100644 --- a/appsettings/migrations/0002_auto_20200527_1603.py +++ b/appsettings/migrations/0002_auto_20200527_1603.py @@ -1,65 +1,38 @@ # 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 _ def add_default_settings(apps, schema_editor): - setting = apps.get_model("appsettings", "AppSettings") db_alias = schema_editor.connection.alias setting.objects.using(db_alias).bulk_create([ - setting(1, "Theme", "BOOTSTRAP_THEME", "flaty", - "", "Bootstrap CSS & Bootswatch Theme"), - setting(2, "Theme SASS Path", "SASS_DIR", "dev/scss/", - "", "Bootstrap SASS & Bootswatch SASS Directory"), - setting(3, "All Instances View Style", "VIEW_INSTANCES_LIST_STYLE", - "grouped", "grouped,nongrouped", "All instances list style"), - setting(4, "Logs per Page", "LOGS_PER_PAGE", - "100", "", "Pagination for logs"), - setting(5, "Multiple Owner for VM ", "ALLOW_INSTANCE_MULTIPLE_OWNER", - "True", "True,False", "Allow to have multiple owner for instance"), - setting(6, "Quota Debug", "QUOTA_DEBUG", "True", - "True,False", "Debug for user quotas"), - setting(7, "Disk Format", "INSTANCE_VOLUME_DEFAULT_FORMAT", - "qcow2", "raw,qcow,qcow2", "Instance disk format"), - setting(8, "Disk Bus", "INSTANCE_VOLUME_DEFAULT_BUS", "virtio", - "virtio,scsi,ide,usb,sata", "Instance disk bus type"), - setting(9, "Disk SCSI Controller", "INSTANCE_VOLUME_DEFAULT_SCSI_CONTROLLER", - "virtio-scsi", "virtio-scsi, lsilogic, virtio-blk", "SCSI controller type"), - setting(10, "Disk Cache", "INSTANCE_VOLUME_DEFAULT_CACHE", "directsync", - "default,directsync,none,unsafe,writeback,writethrough", "Disk volume cache type"), - setting(11, "Disk IO Type", "INSTANCE_VOLUME_DEFAULT_IO", - "default", "default,native,threads", "Volume io modes"), - setting(12, "Disk Detect Zeroes", "INSTANCE_VOLUME_DEFAULT_DETECT_ZEROES", - "default", "default,on,off,unmap", "Volume detect zeroes mode"), - setting(13, "Disk Discard", "INSTANCE_VOLUME_DEFAULT_DISCARD", - "default", "default,unmap,ignore", "Volume discard mode"), - setting(14, "Disk Owner UID", "INSTANCE_VOLUME_DEFAULT_OWNER_UID", "0", - "", "Owner UID: up to os, 0=root, 107=qemu or libvirt-bin(for ubuntu)"), - setting(15, "Disk Owner GID", "INSTANCE_VOLUME_DEFAULT_OWNER_GID", "0", - "", "Owner GID: up to os, 0=root, 107=qemu or libvirt-bin(for ubuntu)"), - setting(16, "VM CPU Mode", "INSTANCE_CPU_DEFAULT_MODE", "host-model", - "no-model,host-model,host-passthrough,custom", "Cpu modes"), - setting(17, "VM Machine Type", "INSTANCE_MACHINE_DEFAULT_TYPE", - "q35", "q35,x86_64", "Chipset/Machine type"), - setting(18, "VM Firmware Type", "INSTANCE_FIRMWARE_DEFAULT_TYPE", - "BIOS", "BIOS,UEFI", "Firmware type for x86_64"), - setting(19, "VM Architecture Type", "INSTANCE_ARCH_DEFAULT_TYPE", - "x86_64", "x86_64,i686", "Architecture type: x86_64, i686, etc"), - setting(20, "VM Console Type", "QEMU_CONSOLE_DEFAULT_TYPE", - "vnc", "vnc,spice", "Default console type"), - setting(21, "VM Clone Name Prefix", "CLONE_INSTANCE_DEFAULT_PREFIX", - "instance", "True,False", "Prefix for cloned instance name"), - setting(22, "VM Clone Auto Name", "CLONE_INSTANCE_AUTO_NAME", - "False", "True,False", "Generated name for cloned instance"), - setting(23, "VM Clone Auto Migrate", "CLONE_INSTANCE_AUTO_MIGRATE", - "False", "True,False", "Auto migrate instance after clone"), - setting(24, "VM Bottom Bar", "VIEW_INSTANCE_DETAIL_BOTTOM_BAR", - "True", "True,False", "Bottom navbar for instance details"), - setting(25, "Show Access Root Pass", "SHOW_ACCESS_ROOT_PASSWORD", - "False", "True,False", "Show access root password"), - setting(26, "Show Access SSH Keys", "SHOW_ACCESS_SSH_KEYS", - "False", "True,False", "Show access ssh keys"), + setting(1, _("Theme"), "BOOTSTRAP_THEME", "flaty", "", _("Bootstrap CSS & Bootswatch Theme")), + setting(2, _("Theme SASS Path"), "SASS_DIR", "dev/scss/", "", _("Bootstrap SASS & Bootswatch SASS Directory")), + setting(3, _("All Instances View Style"), "VIEW_INSTANCES_LIST_STYLE", "grouped", "grouped,nongrouped", _("All instances list style")), + setting(4, _("Logs per Page"), "LOGS_PER_PAGE", "100", "", _("Pagination for logs")), + setting(5, _("Multiple Owner for VM"), "ALLOW_INSTANCE_MULTIPLE_OWNER", "True", "True,False", _("Allow to have multiple owner for instance")), + setting(6, _("Quota Debug"), "QUOTA_DEBUG", "True", "True,False", _("Debug for user quotas")), + setting(7, _("Disk Format"), "INSTANCE_VOLUME_DEFAULT_FORMAT", "qcow2", "raw,qcow,qcow2", _("Instance disk format")), + setting(8, _("Disk Bus"), "INSTANCE_VOLUME_DEFAULT_BUS", "virtio", "virtio,scsi,ide,usb,sata", _("Instance disk bus type")), + setting(9, _("Disk SCSI Controller"), "INSTANCE_VOLUME_DEFAULT_SCSI_CONTROLLER", "virtio-scsi", "virtio-scsi, lsilogic, virtio-blk", _("SCSI controller type")), + setting(10, _("Disk Cache"), "INSTANCE_VOLUME_DEFAULT_CACHE", "directsync", "default,directsync,none,unsafe,writeback,writethrough", _("Disk volume cache type")), + setting(11, _("Disk IO Type"), "INSTANCE_VOLUME_DEFAULT_IO", "default", "default,native,threads", _("Volume io modes")), + setting(12, _("Disk Detect Zeroes"), "INSTANCE_VOLUME_DEFAULT_DETECT_ZEROES", "default", "default,on,off,unmap", _("Volume detect zeroes mode")), + setting(13, _("Disk Discard"), "INSTANCE_VOLUME_DEFAULT_DISCARD", "default", "default,unmap,ignore", _("Volume discard mode")), + setting(14, _("Disk Owner UID"), "INSTANCE_VOLUME_DEFAULT_OWNER_UID", "0", "", _("Owner UID: up to os, 0=root, 107=qemu or libvirt-bin(for ubuntu)")), + setting(15, _("Disk Owner GID"), "INSTANCE_VOLUME_DEFAULT_OWNER_GID", "0", "", _("Owner GID: up to os, 0=root, 107=qemu or libvirt-bin(for ubuntu)")), + setting(16, _("VM CPU Mode"), "INSTANCE_CPU_DEFAULT_MODE", "host-model", "no-model,host-model,host-passthrough,custom", _("Cpu modes")), + setting(17, _("VM Machine Type"), "INSTANCE_MACHINE_DEFAULT_TYPE", "q35", "q35,x86_64", _("Chipset/Machine type")), + setting(18, _("VM Firmware Type"), "INSTANCE_FIRMWARE_DEFAULT_TYPE", "BIOS", "BIOS,UEFI", _("Firmware type for x86_64")), + setting(19, _("VM Architecture Type"), "INSTANCE_ARCH_DEFAULT_TYPE", "x86_64", "x86_64,i686", _("Architecture type: x86_64, i686, etc")), + setting(20, _("VM Console Type"), "QEMU_CONSOLE_DEFAULT_TYPE", "vnc", "vnc,spice", _("Default console type")), + setting(21, _("VM Clone Name Prefix"), "CLONE_INSTANCE_DEFAULT_PREFIX", "instance", "True,False", _("Prefix for cloned instance name")), + setting(22, _("VM Clone Auto Name"), "CLONE_INSTANCE_AUTO_NAME", "False", "True,False", _("Generated name for cloned instance")), + setting(23, _("VM Clone Auto Migrate"), "CLONE_INSTANCE_AUTO_MIGRATE", "False", "True,False", _("Auto migrate instance after clone")), + setting(24, _("VM Bottom Bar"), "VIEW_INSTANCE_DETAIL_BOTTOM_BAR", "True", "True,False", _("Bottom navbar for instance details")), + setting(25, _("Show Access Root Pass"), "SHOW_ACCESS_ROOT_PASSWORD", "False", "True,False", _("Show access root password")), + setting(26, _("Show Access SSH Keys"), "SHOW_ACCESS_SSH_KEYS", "False", "True,False", _("Show access ssh keys")), ]) diff --git a/appsettings/models.py b/appsettings/models.py index ed1b73c..0e0393c 100644 --- a/appsettings/models.py +++ b/appsettings/models.py @@ -1,13 +1,13 @@ from django.db import models - +from django.utils.translation import ugettext_lazy as _ class AppSettings(models.Model): def choices_as_list(self): return self.choices.split(',') - name = models.CharField(max_length=25, null=False) - key = models.CharField(db_index=True, max_length=50, unique=True) - value = models.CharField(max_length=25) - choices = models.CharField(max_length=50) - description = models.CharField(max_length=100, null=True) + name = models.CharField(_('name'), max_length=25, null=False) + key = models.CharField(_('key'), db_index=True, max_length=50, unique=True) + value = models.CharField(_('value'), max_length=25) + choices = models.CharField(_('choices'), max_length=50) + description = models.CharField(_('description'), max_length=100, null=True) diff --git a/appsettings/templates/appsettings.html b/appsettings/templates/appsettings.html index f1942d4..e584136 100644 --- a/appsettings/templates/appsettings.html +++ b/appsettings/templates/appsettings.html @@ -37,9 +37,9 @@ {% if request.user.is_superuser %}
{% csrf_token %}
- +
- +
@@ -47,7 +47,7 @@
- {% for theme in themes_list %} {% endfor %} @@ -61,16 +61,16 @@ {% for setting in appsettings %}
{% csrf_token %}
- +
{% if setting.choices %} - {% for choice in setting.choices_as_list %} {% endfor %} {% else %} - + {% endif%}
diff --git a/appsettings/views.py b/appsettings/views.py index b2ab57c..0b95cf8 100644 --- a/appsettings/views.py +++ b/appsettings/views.py @@ -20,7 +20,7 @@ def appsettings(request): :return: """ error_messages = [] - + main_css = "wvc-main.min.css" sass_dir = AppSettings.objects.get(key="SASS_DIR") bootstrap_theme = AppSettings.objects.get(key="BOOTSTRAP_THEME") try: @@ -59,7 +59,7 @@ def appsettings(request): 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/wvc-main.min.css", "w") as css: + with open("static/css/" + main_css, "w") as css: css.write(css_compressed) bootstrap_theme.value = theme diff --git a/computes/models.py b/computes/models.py index bda751b..c2ab052 100644 --- a/computes/models.py +++ b/computes/models.py @@ -1,12 +1,12 @@ from django.db.models import Model, CharField, IntegerField - +from django.utils.translation import ugettext_lazy as _ class Compute(Model): - name = CharField(max_length=64, unique=True) - hostname = CharField(max_length=64) - login = CharField(max_length=20) - password = CharField(max_length=14, blank=True, null=True) - details = CharField(max_length=64, null=True, blank=True) + name = CharField(_('name'), max_length=64, unique=True) + hostname = CharField(_('hostname'), max_length=64) + login = CharField(_('login'), max_length=20) + password = CharField(_('password'), max_length=14, blank=True, null=True) + details = CharField(_('details'), max_length=64, null=True, blank=True) type = IntegerField() def __unicode__(self): diff --git a/computes/templates/computes.html b/computes/templates/computes.html index 8b37ab2..3e7f98b 100644 --- a/computes/templates/computes.html +++ b/computes/templates/computes.html @@ -16,7 +16,7 @@
{% if computes_info %} {% for compute in computes_info %} -
+
{% if compute.status is True %}
@@ -37,17 +37,17 @@
-
{% trans "Status" %}
+
{% trans "Status" %}
{% if compute.status %} -
{% trans "Connected" %}
+
{% trans "Connected" %}
{% else %} -
{% trans "Not Connected" %}
+
{% trans "Not Connected" %}
{% endif %} -
{% trans "Details" %}
+
{% trans "Details" %}
{% if compute.details %} -
{% trans compute.details %}
+
{% trans compute.details %}
{% else %} -
{% trans "No details available" %}
+
{% trans "No details available" %}
{% endif %}
@@ -63,7 +63,7 @@ {% csrf_token %}