1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2024-10-31 19:44:16 +00:00

Increase some max_length

This commit is contained in:
T. Tran 2019-11-09 00:07:02 +07:00
parent a66ebba12b
commit 08e694db4d
6 changed files with 20 additions and 19 deletions

1
.gitignore vendored
View file

@ -3,6 +3,7 @@ venv
.vscode
.idea
.DS_*
.webvirtcloud
*.pyc
db.sqlite3*
console/cert.pem*

View file

@ -6,7 +6,7 @@ from computes.models import Compute
class ComputeAddTcpForm(forms.Form):
name = forms.CharField(error_messages={'required': _('No hostname has been entered')},
max_length=20)
max_length=64)
hostname = forms.CharField(error_messages={'required': _('No IP / Domain name has been entered')},
max_length=100)
login = forms.CharField(error_messages={'required': _('No login has been entered')},
@ -45,7 +45,7 @@ class ComputeAddTcpForm(forms.Form):
class ComputeAddSshForm(forms.Form):
name = forms.CharField(error_messages={'required': _('No hostname has been entered')},
max_length=20)
max_length=64)
hostname = forms.CharField(error_messages={'required': _('No IP / Domain name has been entered')},
max_length=100)
login = forms.CharField(error_messages={'required': _('No login has been entered')},
@ -82,7 +82,7 @@ class ComputeAddSshForm(forms.Form):
class ComputeAddTlsForm(forms.Form):
name = forms.CharField(error_messages={'required': _('No hostname has been entered')},
max_length=20)
max_length=64)
hostname = forms.CharField(error_messages={'required': _('No IP / Domain name has been entered')},
max_length=100)
login = forms.CharField(error_messages={'required': _('No login has been entered')},
@ -122,7 +122,7 @@ class ComputeAddTlsForm(forms.Form):
class ComputeEditHostForm(forms.Form):
host_id = forms.CharField()
name = forms.CharField(error_messages={'required': _('No hostname has been entered')},
max_length=20)
max_length=64)
hostname = forms.CharField(error_messages={'required': _('No IP / Domain name has been entered')},
max_length=100)
login = forms.CharField(error_messages={'required': _('No login has been entered')},
@ -152,7 +152,7 @@ class ComputeEditHostForm(forms.Form):
class ComputeAddSocketForm(forms.Form):
name = forms.CharField(error_messages={'required': _('No hostname has been entered')},
max_length=20)
max_length=64)
details = forms.CharField(error_messages={'required': _('No details has been entred')},
max_length=50)

View file

@ -2,8 +2,8 @@ from django.db import models
class Compute(models.Model):
name = models.CharField(max_length=20)
hostname = models.CharField(max_length=20)
name = models.CharField(max_length=64)
hostname = models.CharField(max_length=64)
login = models.CharField(max_length=20)
password = models.CharField(max_length=14, blank=True, null=True)
details = models.CharField(max_length=50, null=True, blank=True)

View file

@ -3,7 +3,7 @@ from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from instances.models import Instance
from vrtManager.instance import wvmInstance
from webvirtcloud.settings import WS_PORT
from webvirtcloud.settings import WS_PUBLIC_PORT
from webvirtcloud.settings import WS_PUBLIC_HOST
from libvirt import libvirtError
@ -38,7 +38,7 @@ def console(request):
console_websocket_port = None
console_passwd = None
ws_port = console_websocket_port if console_websocket_port else WS_PORT
ws_port = console_websocket_port if console_websocket_port else WS_PUBLIC_PORT
ws_host = WS_PUBLIC_HOST if WS_PUBLIC_HOST else request.get_host()
if ':' in ws_host:

View file

@ -8,7 +8,7 @@ from webvirtcloud.settings import QEMU_CONSOLE_LISTEN_ADDRESSES
class FlavorAddForm(forms.Form):
label = forms.CharField(label="Name",
error_messages={'required': _('No flavor name has been entered')},
max_length=20)
max_length=64)
vcpu = forms.IntegerField(label="VCPU",
error_messages={'required': _('No VCPU has been entered')}, )
disk = forms.IntegerField(label="HDD",
@ -21,7 +21,7 @@ class FlavorAddForm(forms.Form):
have_symbol = re.match('^[a-zA-Z0-9._-]+$', label)
if not have_symbol:
raise forms.ValidationError(_('The flavor name must not contain any special characters'))
elif len(label) > 20:
elif len(label) > 64:
raise forms.ValidationError(_('The flavor name must not exceed 20 characters'))
try:
Flavor.objects.get(label=label)
@ -32,7 +32,7 @@ class FlavorAddForm(forms.Form):
class NewVMForm(forms.Form):
name = forms.CharField(error_messages={'required': _('No Virtual Machine name has been entered')},
max_length=20)
max_length=64)
vcpu = forms.IntegerField(error_messages={'required': _('No VCPU has been entered')})
host_model = forms.BooleanField(required=False)
disk = forms.IntegerField(required=False)
@ -57,7 +57,7 @@ class NewVMForm(forms.Form):
have_symbol = re.match('^[a-zA-Z0-9._-]+$', name)
if not have_symbol:
raise forms.ValidationError(_('The name of the virtual machine must not contain any special characters'))
elif len(name) > 20:
elif len(name) > 64:
raise forms.ValidationError(_('The name of the virtual machine must not exceed 20 characters'))
return name

View file

@ -105,7 +105,7 @@
<label class="col-sm-3 control-label">{% trans "Name" %}</label>
<div class="col-sm-6">
<input type="text" class="form-control" name="name"
placeholder="{% trans "Name" %}" maxlength="14" required
placeholder="{% trans "Name" %}" maxlength="64" required
pattern="[a-zA-Z0-9\.\-_]+">
<input type="hidden" name="vcpu" value="{{ flavor.vcpu }}">
<input type="hidden" name="memory" value="{{ flavor.memory }}">
@ -183,7 +183,7 @@
<div class="form-group">
<label class="col-sm-3 control-label">{% trans "Console Password" %}</label>
<div class="col-sm-6">
<input type="password" class="form-control" name="console_pass" placeholder="{% trans "Console Password" %}" maxlength="14">
<input type="password" class="form-control" name="console_pass" placeholder="{% trans "Console Password" %}" maxlength="64">
</div>
</div>
<div class="form-group">
@ -255,7 +255,7 @@
<div class="form-group">
<label class="col-sm-3 control-label">{% trans "Name" %}</label>
<div class="col-sm-7">
<input type="text" class="form-control" name="name" placeholder="{% trans "Name" %}" maxlength="20" required pattern="[a-zA-Z0-9\.\-_]+">
<input type="text" class="form-control" name="name" placeholder="{% trans "Name" %}" maxlength="64" required pattern="[a-zA-Z0-9\.\-_]+">
</div>
</div>
<div class="form-group">
@ -368,7 +368,7 @@
<div class="form-group">
<label class="col-sm-3 control-label">{% trans "Console Password" %}</label>
<div class="col-sm-7">
<input type="password" class="form-control" name="console_pass" placeholder="{% trans "Console Password" %}" maxlength="14">
<input type="password" class="form-control" name="console_pass" placeholder="{% trans "Console Password" %}" maxlength="64">
</div>
</div>
<div class="form-group">
@ -413,7 +413,7 @@
<div class="form-group">
<label class="col-sm-3 control-label">{% trans "Name" %}</label>
<div class="col-sm-7">
<input type="text" class="form-control" name="name" placeholder="{% trans "Name" %}" maxlength="20" required pattern="[a-zA-Z0-9\.\-_]+">
<input type="text" class="form-control" name="name" placeholder="{% trans "Name" %}" maxlength="64" required pattern="[a-zA-Z0-9\.\-_]+">
</div>
</div>
<div class="form-group">
@ -527,7 +527,7 @@
<div class="form-group">
<label class="col-sm-3 control-label">{% trans "Console Password" %}</label>
<div class="col-sm-7">
<input type="password" class="form-control" name="console_pass" placeholder="{% trans "Console Password" %}" maxlength="14">
<input type="password" class="form-control" name="console_pass" placeholder="{% trans "Console Password" %}" maxlength="64">
</div>
</div>
<div class="form-group">