import string import random from .. import db from ..models import User, Role, Region from flask_wtf import FlaskForm, RecaptchaField from wtforms import StringField, PasswordField, BooleanField, SubmitField, SelectField, DecimalField from wtforms import validators, ValidationError from wtforms.fields.html5 import EmailField class ChargeForm(FlaskForm): amount = DecimalField('Стойност:', [validators.DataRequired(), validators.NumberRange(min=1, max=500)]) submit = SubmitField('Зареди') class Addr2PoolForm(FlaskForm): #regions = Region.query.all() #region_choices = [] #for region in regions: # region_choices.expand((region.pid, str(region.description))) region_choices = [(1, 'Plovdiv, Bulgaria')] ip = StringField('IP Address:', [validators.DataRequired(), validators.Regexp(message='172.16.0.1', regex='^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$')]) region = SelectField('Region', choices=region_choices, coerce=int) reserved = BooleanField('Reserved:') submit = SubmitField('Add IP')