class CreateElementCodeForm(Form): code = StringField( 'Code (Optional)', validators=[validators.Length(min=0, max=100)]) otherLdcCodes = StringField( 'Other LDC Codes', [validators.Length(min=0, max=150)]) codeDescription = StringField( 'Description', validators=[validators.DataRequired(), validators.Length(min=1, max=500)], widget=TextArea()) codeTags = StringField('Tag(s)', [validators.Length(min=0, max=500)]) codeIssuedTo = StringField( 'Issued To', [validators.DataRequired(), validators.Length(min=1, max=500)]) codeIssueTime = DateTimeField( 'Issue Time (Optional)', format='%Y-%m-%d %H:%M', validators=[validators.Optional()]) elementId = h5fields.IntegerField( "Element Id", widget=h5widgets.NumberInput(min=0, step=1) ) elementTypeId = h5fields.IntegerField( "Element Type Id", widget=h5widgets.NumberInput(min=0, step=1), validators=[validators.DataRequired()] ) elementName = StringField( "Element Name", validators=[validators.DataRequired(), validators.Length(min=1, max=500)]) elementType = StringField( "Element Type", validators=[validators.DataRequired(), validators.Length(min=1, max=250)])
class WACCForm(FlaskForm): weights = PassSelectField('Risk Free Weighting', choices=weights(), default='1', coerce=str) country = SelectField('Country', choices=countries(), default=u'Greece', coerce=str) beta = PassSelectField('Beta', choices=betas(), default='1', coerce=str) beta_manual = FlexiFloatField('Beta Manual', validators=[Optional()], default=None, render_kw={'disabled': ''}, widget=html5.NumberInput(step=0.01)) yield_on_debt = FlexiFloatField('Yield On Debt %', validators=[InputRequired()], default=1.0, render_kw={"placeholder": "%"}, widget=html5.NumberInput(step=0.01)) tax = FlexiFloatField('Tax %', validators=[InputRequired()], default=0.0, render_kw={"placeholder": "%"}, widget=html5.NumberInput(min=0, max=100, step=0.1)) mvalue_debt = FlexiFloatField('Mkt Value Debt', validators=[InputRequired()], default=1.0, widget=html5.NumberInput(step=0.001)) mvalue_equity = FlexiFloatField('Mkt Value Equity', validators=[InputRequired()], default=1.0, widget=html5.NumberInput(step=0.001))
class EditarFrios(FlaskForm): id = html5.IntegerField('Id', widget=h5widgets.NumberInput( min=0), validators=[InputRequired()]) nome = StringField('Nome', [InputRequired('Este campo é Obrigatório')]) quantidade = html5.IntegerField('Quantidade', widget=h5widgets.NumberInput( min=1), validators=[InputRequired()]) preco = html5.DecimalField('Preço', validators=[InputRequired()])
class CompanyMaintenanceForm(FlaskForm): company_name = StringField('Name', render_kw={"placeholder": "Name"}, validators=[DataRequired()]) address = StringField('Address', render_kw={"placeholder": "Address"}, validators=[DataRequired()]) phone = StringField('Phone', render_kw={"placeholder": "Phone"}, validators=[DataRequired()]) mobile = StringField('Mobile', render_kw={"placeholder": "Mobile"}, validators=[DataRequired()]) total_fund = FloatField('Total Fund', widget=html5.NumberInput(), render_kw={"placeholder": "Total Fund"}, validators=[DataRequired()]) available_fund = FloatField('Available Fund', widget=html5.NumberInput(), render_kw={"placeholder": "Available Fund"}, validators=[DataRequired()]) lended_fund = FloatField('Lended Fund', widget=html5.NumberInput(), render_kw={"placeholder": "Lended Fund"}, validators=[DataRequired()]) total_profit = FloatField('Total Profit', widget=html5.NumberInput(), render_kw={"placeholder": "Total Profit"}, validators=[DataRequired()]) interest_rate = FloatField('Interest Rate', widget=html5.NumberInput(), render_kw={"placeholder": "Interest Rate"}, validators=[DataRequired()]) submit_company_update = SubmitField('Save')
class TransactionLoanForm(FlaskForm): uuid = HiddenField('uuid') code = StringField('Code', render_kw={"placeholder": "Code", "readonly": "readonly"}) borrower_code = StringField('Borrower Code', render_kw={"placeholder": "Borrower Code"}, validators=[DataRequired()]) borrower_name = StringField('Name', render_kw={"placeholder": "Code", "readonly": "readonly"}) date_start = DateField('Date Start', format='%Y-%m-%d', render_kw={"onkeydown": "return false"}, validators=[DataRequired()]) date_end = DateField('Date End (YYYY-MM-DD)', render_kw={"placeholder": "YYYY-MM-DD"}) type_loan = SelectField('Loan Type', choices=[('',''), ('Quote','Quote'),('Loan','Loan')], validators=[DataRequired()]) terms = IntegerField('Terms', widget=html5.NumberInput(), render_kw={"placeholder": "Terms"}, validators=[DataRequired()]) type_schedule = SelectField('Schedule Type', choices=[('',''), ('Semi-Monthly','Semi-Monthly'), ('Monthly','Monthly')], validators=[DataRequired()]) is_settled = BooleanField('Is settled?') amount = FloatField('Amount', widget=html5.NumberInput(), render_kw={"placeholder": "Amount"}, validators=[DataRequired()]) amount_gross = FloatField('Gross', render_kw={"placeholder": "Gross"}) interest_rate = FloatField('Interest rate', widget=html5.NumberInput(), render_kw={"placeholder": "Interest rate"}, validators=[DataRequired()]) interest_amount = FloatField('Interest amount', render_kw={"placeholder": "Interest amount"}) remarks = StringField('Remarks', render_kw={"placeholder": "Remarks"}, validators=[DataRequired()]) is_approved = BooleanField('Is Approved?') submit_transaction_loan_add = SubmitField('Create') submit_transaction_loan_update = SubmitField('Update') submit_transaction_loan_delete = SubmitField('Delete') submit_transaction_loan_approve = SubmitField('Approve') submit_transaction_loan_penalty_add = SubmitField('Add Penalty') submit_transaction_loan_settle = SubmitField('Complete') submit_transaction_loan_back = SubmitField('Back') def validate_terms(form, field): if int(field.data) < 1: raise ValidationError("This field is required.") else: if form.type_schedule.data == 'Semi-Monthly' and int(field.data) > 24: raise ValidationError("Maximum Terms is 1 year") if form.type_schedule.data == 'Monthly' and int(field.data) > 12: raise ValidationError("Maximum Terms is 1 year")
class UpdateFurnitureForm(FlaskForm): name = StringField( 'Name', [validators.Length(min=1, max=150), validators.DataRequired()]) imageUpdate = FileField( 'Select Image (Only .JPG, .webp, and .PNG allowed)', validators=[validateupdateimg()]) cost = DecimalField('Cost ($)', validators=[costvalidate()]) tags = TextAreaField( "Type Tags of this Furniture here (Use multiple lines to separate Tags) ", [validators.data_required()]) description = TextAreaField('Description', [validators.data_required()]) length = IntegerField( 'Length (cm)', widget=html5.NumberInput(), validators=[validators.InputRequired(), lwhvalidate()]) width = IntegerField( 'Width (cm)', widget=html5.NumberInput(), validators=[validators.InputRequired(), lwhvalidate()]) height = IntegerField( 'Height (cm)', widget=html5.NumberInput(), validators=[validators.InputRequired(), lwhvalidate()])
class PokemonForm(FlaskForm): id = IntegerField( label = "ID", widget = html5.NumberInput(), validators = [ validators.NumberRange(min=1), validators.InputRequired() ] ) name = StringField( label = "Name", validators = [ validators.Length(min=1), validators.InputRequired() ] ) generation = IntegerField( label = "Generation", widget = html5.NumberInput(), validators = [ validators.NumberRange(min=1), validators.InputRequired() ] ) released = BooleanField( label = "Released" ) submit = SubmitField() class Meta: csrf = False
class InputForm(FlaskForm): x = IntegerField('First Integer', validators=[DataRequired()], widget=html5.NumberInput()) y = IntegerField('Second Integer', validators=[DataRequired()], widget=html5.NumberInput()) submit = SubmitField('Calculate')
def test_number(self): i1 = html5.NumberInput(step='any') self.assertEqual( i1(self.field), '<input id="id" name="bar" step="any" type="number" value="42">') i2 = html5.NumberInput(step=2) self.assertEqual( i1(self.field, step=3), '<input id="id" name="bar" step="3" type="number" value="42">')
def test_number(self): i1 = html5.NumberInput(step='any') self.assertEqual(i1(self.field), '<input id="id" name="bar" step="any" type="number" value="42">') i2 = html5.NumberInput(step=2) self.assertEqual(i2(self.field, step=3), '<input id="id" name="bar" step="3" type="number" value="42">') i3 = html5.NumberInput(min=10) self.assertEqual(i3(self.field), '<input id="id" min="10" name="bar" type="number" value="42">') self.assertEqual(i3(self.field, min=5), '<input id="id" min="5" name="bar" type="number" value="42">') i4 = html5.NumberInput(max=100) self.assertEqual(i4(self.field), '<input id="id" max="100" name="bar" type="number" value="42">') self.assertEqual(i4(self.field, max=50), '<input id="id" max="50" name="bar" type="number" value="42">')
class SetParameters(Form): """first_name = StringField('First name', validators=[DataRequired("Please enter your first name.")]) last_name = StringField('Last name', validators=[DataRequired("Please enter your last name.")]) email = StringField('Email', validators=[DataRequired("Please enter your email address."), Email("Please enter your email address.")]) password = PasswordField('Password', validators=[DataRequired("Please enter a password."), Length(min=6, message="Passwords must be 6 characters or more.")])""" no_of_topic=IntegerField("Topic Number:",widget=html5.NumberInput(),validators=[DataRequired("Please enter number of topic u desired.")]) no_of_words=IntegerField("Top Words Number:",widget=html5.NumberInput(),validators=[DataRequired("Please enter number of words u desired.")]) no_of_documents=IntegerField("Top document Number:",widget=html5.NumberInput(),validators=[DataRequired("Please enter number of documents u desired.")]) submit = SubmitField('Show Results')
class SecUploadForm(FlaskForm): img = FileField("主密码图像",validators=[DataRequired(message="上传主秘密图像!")]) name = StringField("秘密名称",validators=[DataRequired()]) shareNums = IntegerField("分享人数", validators=[DataRequired(),NumberRange(min=1,message="最小人数必须大于0")], widget=html5.NumberInput()) needNums = IntegerField("参与人数", validators=[DataRequired(),NumberRange(min=1,message="最小人数必须大于0"),Compare('shareNums')], widget=html5.NumberInput()) user = SelectMultipleField("分发给用户") submit = SubmitField("分发子秘密")
class UploadForm(FlaskForm): format = HiddenField("Format", validators=[InputRequired()]) # MILIG, CAMS or RMSJSON upload_methods = [] # options max_toffset = DecimalField('max_toffset', places=2, default=5.00, widget=html5.NumberInput()) v_init_part = DecimalField('v_init_part', places=2, default=0.25, widget=html5.NumberInput()) v_init_ht = DecimalField('v_init_ht', places=2, default=-1, widget=html5.NumberInput()) # TODO: recaptcha? def validate_format(form, field): if field.data not in trajectory.app.config.get('FORMS'): raise ValidationError('format must be either "MILIG", "CAMS" or "RMSJSON" ')
class spendLivestock(FlaskForm): dateNote4 = DateField('Choose Spending Date', format='%Y-%m-%d', validators=[InputRequired()]) livestockEx_name = SelectField(u'Choose Livestock Expense', coerce=int, validators=[InputRequired()]) livestockEx_amount = IntegerField('Spending Amount', widget=html5.NumberInput(), validators=[InputRequired()]) livestockEx_money = IntegerField('Monetary equivalent', widget=html5.NumberInput(), validators=[InputRequired()]) note = TextAreaField(u'Note', validators=[Optional(), Length(max=200)]) submit4 = SubmitField('Spent')
class harvestLivestock(FlaskForm): dateNote2 = DateField('Choose Harvesting Date', format='%Y-%m-%d', validators=[InputRequired()]) livestock_name = SelectField(u'Choose Livestock', coerce=int, validators=[InputRequired()]) livestock_amount = IntegerField('Harvesting Amount', widget=html5.NumberInput(), validators=[InputRequired()]) livestock_money = IntegerField('Monetary equivalent', widget=html5.NumberInput(), validators=[InputRequired()]) note = TextAreaField(u'Note', validators=[Optional(), Length(max=200)]) submit2 = SubmitField('Harvested')
class harvestCrop(FlaskForm): dateNote1 = DateField('Choose Harvesting Date', format='%Y-%m-%d', validators=[InputRequired()]) crop_name = SelectField(u'Choose Crop', coerce=int, validators=[InputRequired()]) crop_amount = FloatField('Harvesting Amount', widget=html5.NumberInput(), validators=[InputRequired()]) crop_money = FloatField('Monetary equivalent', widget=html5.NumberInput(), validators=[InputRequired()]) note = TextAreaField(u'Note', validators=[Optional(), Length(max=200)]) submit1 = SubmitField('Harvested')
class PassengerForm(FlaskForm): adult = IntegerField('adult', widget=html5.NumberInput(min=0, max=5), validators=[DataRequired()]) student = IntegerField('student', widget=html5.NumberInput(min=0, max=5), validators=[DataRequired()]) retired = IntegerField('retired', widget=html5.NumberInput(min=0, max=5), validators=[DataRequired()]) child = IntegerField( 'child', widget=html5.NumberInput(min=0, max=5), validators=[DataRequired()], )
class RatingForm(FlaskForm): rating1 = h5fields.IntegerField(_l('Good quality'), validators=[DataRequired()], widget=h5widgets.NumberInput(min=1, max=5)) rating2 = h5fields.IntegerField(_l('Good value for money'), validators=[DataRequired()], widget=h5widgets.NumberInput(min=1, max=5)) rating3 = h5fields.IntegerField(_l('Full nutrition details'), validators=[DataRequired()], widget=h5widgets.NumberInput(min=1, max=5)) rating4 = h5fields.IntegerField(_l('Must-have item'), validators=[DataRequired()], widget=h5widgets.NumberInput(min=1, max=5)) comment = TextAreaField(_l('Comment (option)')) submit = SubmitField(_l('Submit'))
class OrderItemForm(FlaskForm): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) specs = kwargs.get('specs', []) self.item_id.choices = [ (s.id, '{} | {} | Catálogo: {} | {} unidades/produto'.format( s.product.name, s.manufacturer, s.catalog_number, s.units)) for s in specs ] item_id = wtf.SelectField('Reativo', coerce=int, validators=[InputRequired()]) amount = wtf.IntegerField( 'Quantidade', widget=widgets.NumberInput(), render_kw={"autocomplete": "off"}, validators=[ InputRequired(), NumberRange(min=1, max=None, message='Quantidade deve ser maior que zero!') ]) lot_number = wtf.StringField('Lote', render_kw={"autocomplete": "off"}, validators=[InputRequired()]) expiration_date = wtf.DateField('Data de Validade', widget=widgets.DateInput(), validators=[InputRequired()]) add_product = wtf.SubmitField('Adicionar produto ao carrinho') finish_order = wtf.SubmitField('Ir para checkout') cancel = wtf.SubmitField('Limpar o carrinho')
class RequestForm(FlaskForm): item = StringField('Item Name', validators=[DataRequired()]) quantity = IntegerField('Quantity', widget=html5.NumberInput(), validators=[DataRequired()]) instruct = StringField('Special Instructions') send = SubmitField('Place Request')
class CadastroFuncionario(FlaskForm): nome = StringField('Nome', validators=[ InputRequired('Nome é Obrigatório')]) cidade = StringField('Cidade', validators=[ InputRequired('Cidade é Obrigatório')]) cep = StringField('Cep', validators=[InputRequired('Cep é Obritório')]) numero = html5.IntegerField('Número', widget=h5widgets.NumberInput( min=0), validators=[InputRequired('Número é Obrigatório')]) bairro = StringField('Bairro', validators=[ InputRequired('Bairro é Obrigatório')]) rua = StringField('Rua', validators=[InputRequired('Rua é Obrigatório')]) email = html5.EmailField( 'E-mail', validators=[InputRequired('E-mail é Obrigatório')]) telefone = StringField('Telefone', validators=[ InputRequired('Telefone é Obrigatório')]) inicio_contrato = html5.DateField('Data Inicio', validators=[ InputRequired('data requerida')]) login = StringField('Login', validators=[ InputRequired('Login é Obrigatório')]) is_admin = BooleanField('Adminstrador') is_ativo = BooleanField('Ativo') password = PasswordField('Senha', validators=[ InputRequired('Senha é Obrigatória')]) confirmPassword = PasswordField('Confirme a senha', validators=[ InputRequired('Confirmação é Obrigatório')])
class TrackForm(FlaskForm): title = StringField('Tytuł', validators=[DataRequired()]) date_release = h5fields.IntegerField("Rok wydania", widget=h5widgets.NumberInput()) lyrics = TextAreaField('Tekst', validators=[DataRequired()]) description = TextAreaField('Opis utworu') lyrics_by = StringField('Autor tekstu') '''(Proteza)
class UpdateProfileForm(FlaskForm): username = StringField('Username', validators=[DataRequired(), Length(min=2, max=20)]) phoneNumber = StringField('Phone Number', validators=[Length(min=0, max=15)], widget=html5.NumberInput()) gender = StringField('Gender', validators=[DataRequired()]) profile_image = FileField('Update Profile Picture', validators=[FileAllowed(['jpg', 'png'])]) biography = TextAreaField('Your Biography:', validators=[Length(min=0, max=160)]) submit = SubmitField('Update!') def validate_username(self, username): if username.data != current_user.username: user = User.query.filter_by(username=username.data).first() if user: raise ValidationError( 'That username is taken. Please choose a different one.') def validate_phone(self, phoneNumber): if phoneNumber.data != current_user.phoneNumber: phone = User.query.filter_by(phoneNumber=phoneNumber.data).first() if phone: raise ValidationError( 'That phone number is already claimed. Please choose a different one.' )
class RegisterForm(FlaskForm): username = StringField("Username", validators=[DataRequired(), Length(min=2, max=20)]) email = StringField("Email", validators=[DataRequired(), Email()]) password = PasswordField("Password", validators=[DataRequired()]) confirm_password = PasswordField( "Confirm Password", validators=[DataRequired(), EqualTo("password")]) gender = RadioField("Gender", choices=[("male", "Male"), ("female", "Female")], validators=[DataRequired()]) phoneNumber = StringField('Phone Number', validators=[Length(min=0, max=15)], widget=html5.NumberInput()) submit = SubmitField("Sign Up") def validate_username(self, username): user = User.query.filter_by(username=username.data).first() if user: raise ValidationError( "Username has been taken! Please choose another one!") def validate_email(self, email): email = User.query.filter_by(email=email.data).first() if email: raise ValidationError( "Email has been taken! Please choose another one!") def validate_phoneNumber(self, phoneNumber): phoneNumber = User.query.filter_by( phoneNumber=phoneNumber.data).first() if phoneNumber: raise ValidationError( "Phone number has been taken! Please choose another one!")
class BetForm(FlaskForm): amount = IntegerField("Amount", widget=html5.NumberInput()) submit = SubmitField("Bet") def validate_amount(self, amount): if amount.data is None or amount.data <= 0 or amount.data > current_user.funds: raise ValidationError("Invalid bet amount.")
class ProductForm(FlaskForm): product_type = HiddenField('Product Type') product_name = StringField( 'Product Name', validators=[ InputRequired(), Length( min=3, max=100, message='Product title should be between 3 and 100 characters') ]) product_image = FileField('Product Image', validators=[Optional()]) description = TextAreaField('Product Description') description_value = HiddenField( 'Product Description Value', validators=[ InputRequired(), Length( min=3, max=9999, message='Description should be between 3 and 9999 characters') ]) items = TextAreaField('Product Items') attachment_file = SelectField('Attachment File', validators=[Optional()], choices=[]) price = DecimalField('Product Price', validators=[InputRequired()]) stock = IntegerField('Quantity', validators=[Optional()], widget=h5widgets.NumberInput()) categories = SelectMultipleField('Categories', validators=[Optional()], choices=[])
class OrderForm(FlaskForm): invoice_type = wtf.SelectField( 'Tipo de Nota', coerce=str, choices=(('Não informado', 'Não informado'), ('Nota Fiscal', 'Nota Fiscal'), ('Nota de Fornecimento (FIOCRUZ)', 'Nota de Fornecimento (FIOCRUZ)'), ('Nota de Fornecimento (Ministério da Saúde)', 'Nota de Fornecimento (Ministério da Saúde)'), ('Outros', 'Outros')), default='Não informado', validators=[Optional()]) invoice = wtf.StringField('Nota', validators=[Optional()]) invoice_value = wtf.FloatField('Valor total', render_kw={'placeholder': 'R$ 123.40'}, validators=[Optional()], widget=widgets.NumberInput( step='0.01', min='0.00', max='9999999999.99')) financier = wtf.StringField('Financiador', validators=[Optional()]) notes = wtf.StringField('Observações', validators=[Optional()]) submit = wtf.SubmitField('Inserir no estoque') cancel = wtf.SubmitField('Limpar o carrinho')
class MovieForm(FlaskForm): title = StringField('Title', validators=[InputRequired(), Length(min=1, max=50)]) year = IntegerField('Year', widget=html5.NumberInput(), default=datetime.now().year) link = StringField('Link', validators=[InputRequired(), Length(min=1, max=1000)]) view_key = StringField('View Key', validators=[Length(min=1, max=1000)]) is_trending = BooleanField('Is Trending')
class EditElementRevivalCodeForm(Form): codeIssueTime = DateTimeField('Code Issued Time', format='%Y-%m-%d %H:%M', validators=[validators.DataRequired()]) code = StringField('Code', validators=[ validators.DataRequired(), validators.Length(min=1, max=100) ]) otherLdcCodes = StringField('Other LDC Codes', [validators.Length(min=0, max=150)]) codeDescription = StringField( 'Description', [validators.DataRequired(), validators.Length(min=1, max=500)], widget=TextArea()) codeTags = StringField('Tag(s)', [validators.Length(min=0, max=500)]) codeIssuedTo = StringField( 'Issued To', [validators.DataRequired(), validators.Length(min=1, max=500)]) codeExecTime = DateTimeField('Execution Time', format='%Y-%m-%d %H:%M', validators=[validators.Optional()]) codeIssuedBy = StringField('Code Issued By', validators=[ validators.DataRequired(), validators.Length(min=0, max=500) ]) isCodeCancelled = BooleanField("Code Cancelled") rtoId = h5fields.IntegerField('', widget=h5widgets.NumberInput(min=0, step=1), validators=[validators.DataRequired()])
class InventoryConsumingForm(FlaskForm): item = fields.SelectField() consuming_size = fields.IntegerField( default=1, widget=html5widgets.NumberInput(min=1), validators=[validators.NumberRange(min=1)])