23 lines
973 B
Python
23 lines
973 B
Python
from flask_wtf import FlaskForm
|
|
from wtforms import StringField, PasswordField, BooleanField, SubmitField, SelectField, DecimalField
|
|
from wtforms import validators, ValidationError
|
|
from wtforms.fields.html5 import EmailField, DecimalRangeField
|
|
|
|
from .. import db
|
|
|
|
class OrderForm(FlaskForm):
|
|
region_choices = [(1, 'Plovdiv, Bulgaria')]
|
|
region = SelectField('Region:', choices=region_choices, coerce=int)
|
|
|
|
vmtype_choices = [(1, 'RootVPS')]
|
|
vmtype = SelectField('Type:', choices=vmtype_choices, coerce=int)
|
|
|
|
cpu = DecimalRangeField('Processor Cores', default=2)
|
|
memory = DecimalRangeField('Memory', default=512)
|
|
storage = DecimalRangeField('Storage', default=10)
|
|
|
|
alias = StringField('Machine Alias:', [validators.Regexp(message='ex.: myservice1.com, myservice2.local', regex='^[a-zA-Z0-9][a-zA-Z0-9-_]{0,61}[a-zA-Z0-9]{0,1}\.([a-zA-Z]{1,6}|[a-zA-Z0-9-]{1,30}\.[a-zA-Z]{2,3})$'), validators.Length(6,64)])
|
|
|
|
submit = SubmitField('DEPLOY')
|
|
|