class CreateAccount(FlaskForm): acc_cust_id = h5fields.IntegerField( 'Customer ID', validators=[DataRequired()], render_kw={"placeholder": "Customer ID eg. (2,3,1..)"}) accout_type = [("saving", "saving"), ("current", "current"), ("salary", "salary"), ("other", "other")] acc_type = SelectField(u'Account Type', choices=accout_type, validators=[DataRequired()]) acc_deposit = h5fields.IntegerField('Deposit Amount', render_kw={"placeholder": 0}, default=0) acc_submit = SubmitField("Create Account") def validate_acc_cust_id(form, field): if not CustomerStatus.objects(customer_id=field.data).first(): raise ValidationError("customer of this ID does not exists") def validate_acc_type(form, field): if AccountStatus.objects.filter(acc_cust_id=form.acc_cust_id.data, acc_type=field.data).first(): raise ValidationError( f"{field.data} account already exist for customer id {form.acc_cust_id.data}" ) def validate_acc_deposit(form, field): if field.data < 0: raise ValidationError("Please Provide positive data")
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 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 StarfinderAttackMacroForm(FlaskForm): weapon = StringField('Weapon', validators=[DataRequired()], render_kw={'autofocus': True}) to_hit = h5fields.IntegerField('To Hit', validators=[DataRequired()]) ac_type = RadioField('AC', choices=[('KAC', 'KAC'), ('EAC', 'EAC')], validators=[DataRequired()]) damage = StringField('Damage', validators=[DataRequired()]) damage_type = StringField('Damage Type', validators=[DataRequired()]) full_attack_penalty = h5fields.IntegerField( 'Full Attack Penalty', default=-4, validators=[DataRequired(), NumberRange(min=-4, max=0)]) number_of_attacks = h5fields.IntegerField( 'Number of Attacks', default=2, validators=[DataRequired(), NumberRange(min=1, max=4)]) rider_effects = StringField('Rider Effects') trick_attack_check = h5fields.IntegerField('Trick Attack Bonus', validators=[Optional()]) trick_attack_damage = StringField('Trick Attack Damage') ask_to_hit_modifier = BooleanField('Ask to hit modifiers', default='') ask_damage_modifier = BooleanField('Ask damage modifiers', default='') build = SubmitField('Build It!') restart = SubmitField('Start Over!')
class RegistrationForm(FlaskForm): productname = StringField( 'productname', validators=[DataRequired(), Length(min=2, max=20)]) dairyname = StringField('dairyname', validators=[DataRequired(), Length(min=2, max=20)]) id1 = h5fields.IntegerField('id1') price = h5fields.IntegerField('price') submit = SubmitField('Upload')
class ScheduleForm(FlaskForm): number = HiddenField('ID') zone = h5fields.IntegerField( 'zone', [validators.optional(), validators.NumberRange(1, 6)]) disabled = BooleanField('Disabled', [validators.optional()]) interval_days = h5fields.IntegerField('Interval (days)', [validators.optional()]) scheduled_time = h5fields.TimeField('Time', [validators.optional()]) duration_minutes = h5fields.IntegerField('Duration (minutes)', [validators.optional()])
class ProductRegistrationForm(FlaskForm): name = StringField('Product Name', validators=[DataRequired()]) price = h5fields.IntegerField('Product Price', validators=[DataRequired()]) quantity = h5fields.IntegerField('Product Quantity', validators=[DataRequired()]) feature = TextAreaField('Product Features', validators=[DataRequired()]) size = TextAreaField('Product Size', validators=[DataRequired()]) gender = RadioField('Gender', choices=[(1, "Male"), (2, "Female")],default=1, coerce=int) brand = StringField('Product Brand', validators=[DataRequired()]) picture = FileField('Product Image', validators=[FileAllowed(['jpg','jfif', 'png'])]) submit = SubmitField('Register Product')
class EditRecord(FlaskForm): artist_name = wt.StringField('Artist Name (Display)') artist_name_sort = wt.StringField('Artist Name (Sort)') album_name = wt.StringField('Album Name') genre = wt.StringField('Genre') play_count = wt5.IntegerField('Play Count') last_played = wt5.DateField('Last Played', format='%Y-%m-%d') ignore = wt5.IntegerField('Ignore?') release_type = wt.StringField('Release Type') sort_order = wt5.IntegerField('Sort Order') submit = wt.SubmitField('Update')
class EditElementOutageCodeForm(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") outageTypeId = h5fields.IntegerField('', validators=[ validators.DataRequired(), validators.NumberRange(min=0, max=100000) ]) outageTagId = h5fields.IntegerField('', validators=[ validators.DataRequired(), validators.NumberRange(min=0, max=100000) ]) outageType = StringField('', validators=[ validators.DataRequired(), validators.Length(min=1, max=250) ]) outageTag = StringField('', validators=[ validators.DataRequired(), validators.Length(min=1, max=250) ])
class SavesMacroForm(FlaskForm): fortitude = h5fields.IntegerField('Fortitude', validators=[DataRequired()], render_kw={'autofocus': True}) reflex = h5fields.IntegerField('Reflex', validators=[DataRequired()]) will = h5fields.IntegerField('Will', validators=[DataRequired()]) notes = StringField('Notes') mask_rolls = RadioField('Mask rolls?', default='mask', choices=[('no', 'no'), ('mask', '[[[[mask]]]]'), ('whisper', 'whisper to GM')]) build = SubmitField('Build It!') restart = SubmitField('Start Over!')
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 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)
def AreYouARobotFormFactory(*args, **kwargs): def make_hash(n): s = (flask.current_app.config['SECRET_KEY'] + str(n)).encode() h = hashlib.sha256(s).hexdigest() return h class F(flask_wtf.FlaskForm): def validate(self): if self.answer.data != make_hash(self.question.data): errors = list(self.question.errors) errors.append(_l("Fel svar.")) self.question.errors = errors self.answer.data = self.answer.default return False self.answer.data = self.answer.default return True x, y = random.randint(1, 9), random.randint(1, 9) answer = x + y ans_hash = make_hash(answer) F.question = html5_fields.IntegerField( _l("Vad är %(x)d + %(y)d?", x=x, y=y), validators=[validators.InputRequired()]) F.answer = fields.HiddenField(default=ans_hash) return F(*args, **kwargs)
class EditArticleForm(flask_wtf.FlaskForm): name = fields.StringField( _l('Namn'), validators=[validators.InputRequired(), validators.Length(max=15)]) value = html5_fields.DecimalField(_l('Pris'), default=0, render_kw={ 'step': .01, 'min': -1000, 'max': 1000 }, validators=[ validators.InputRequired(), validators.NumberRange(min=-1000, max=1000), ]) standardglas = html5_fields.DecimalField(_l('Standardglas'), default=1, render_kw={'step': .1}, validators=[ validators.InputRequired(), ]) description = fields.TextAreaField( _l('Beskrivning'), description=_l("Vilka produkter som ingår och/eller beskrivning. " "Markdown.")) weight = html5_fields.IntegerField( _l('Sorteringsvikt'), description=_l("Heltal. En högre vikt stiger."), validators=[validators.InputRequired()]) is_active = fields.BooleanField( _l('Aktiv'), description=_l("Produkten är synlig och går att strequa på."), default=True)
class EditUserForm(flask_wtf.FlaskForm): nickname = fields.StringField(_l('Smeknamn'), description=_l("Något roligt."), validators=[validators.Length(max=50)]) birthday = html5_fields.DateField(_l('Datum'), description=_l("Din födelsedags datum."), validators=[validators.Optional()]) phone = html5_fields.TelField( _l('Telefon'), description=_l("Ett telefonnummer. Landskod kan utelämnas för svenska" " nummer, men behövs för utländska nummer.")) body_mass = html5_fields.IntegerField( _l('Kroppsvikt'), description=_l("Din vikt i kg. Används för att mer precist räkna ut " "alkoholkoncentrationen i blodet. Fältet kan lämnas " "tomt"), render_kw={ 'min': 1, 'max': 20743 }, validators=[ validators.NumberRange(min=1, max=20743), validators.Optional() ]) y_chromosome = fields.SelectField( _l('Har du en Y-kromosom?'), description=_l("Används för att mer precist räkna ut " "alkoholkoncentrationen i blodet."), choices=[('n/a', _l('Vill ej uppge')), ('yes', _l('Ja')), ('no', _l('Nej'))], validators=[validators.Optional()])
class UpdateCustomer(FlaskForm): cust_id = IntegerField(widget=HiddenInput()) # cust_id = HiddenField() cust_name = StringField(' Name', validators=[Optional(), Length(min=2, max=55)], render_kw={"placeholder": "Customer Name"}) cust_age = h5fields.IntegerField(u'Age', validators=[Optional()], render_kw={"placeholder": "Customer Age"}) cust_address = TextAreaField( u'Customer Address', validators=[Optional(), Length(min=10, max=500)], render_kw={"placeholder": "Customer Address"}) cust_submit = SubmitField("Update Customer") def validate_cust_name(form, field): if not field.data: return if re.match(".*\d.*", field.data): # if not any(char.isdigit() for char in data) raise ValidationError("Name cant contain digits") def validate_cust_age(form, field): if not field.data: return if field.data < 13: raise ValidationError( "We're sorry, you must be 13 or older to register") if field.data > 150: raise ValidationError("We're sorry, Age is invalid")
class EditUserForm(flask_wtf.FlaskForm): nickname = fields.StringField('Smeknamn', description="Något roligt.") phone = html5_fields.TelField( 'Telefon', description="Ett telefonnummer, med eller utan landskod.") body_mass = html5_fields.IntegerField( 'Kroppsvikt', description=("Din vikt i kg. Används för att mer precist räkna ut " "alkoholkoncentrationen i blodet. Fältet kan lämnas " "tomt"), render_kw={ 'min': 1, 'max': 20743 }, validators=[ validators.NumberRange(min=1, max=20743), validators.Optional() ]) y_chromosome = fields.SelectField( 'Har du en Y-kromosom?', description=("Används för att mer precist räkna ut " "alkoholkoncentrationen i blodet."), choices=[('n/a', 'Vill ej uppge'), ('yes', 'Ja'), ('no', 'Nej')])
class ShipWeaponField(Form): weapon_name = StringField('Name') range = h5fields.IntegerField("Range", validators=[Optional()]) weapon_type = RadioField('Type', choices=[('direct', 'direct'), ('tracking', 'tracking')], validators=[Optional()]) tracking_speed = h5fields.IntegerField("Tracking Speed", validators=[Optional()]) facing = RadioField('Facing', choices=[('turret', 'turret'), ('forward', 'forward'), ('port', 'port'), ('starboard', 'starboard'), ('aft', 'aft')], validators=[Optional()]) damage = StringField('Damage') special = StringField('Special') use_computers = BooleanField("Use computers?")
class CreateElementOutageCodeForm(Form): outageReason = StringField('Description', validators=[ validators.DataRequired(), validators.Length(min=1, max=500) ], widget=TextArea()) outageTime = DateTimeField('Outage Time', format='%Y-%m-%d %H:%M', validators=[validators.DataRequired()]) elementId = h5fields.IntegerField('', widget=h5widgets.NumberInput(min=0, step=1), validators=[validators.DataRequired()]) elementTypeId = h5fields.IntegerField( '', widget=h5widgets.NumberInput(min=0, step=1), validators=[validators.DataRequired()]) outageTypeId = h5fields.IntegerField( '', widget=h5widgets.NumberInput(min=0, step=1), validators=[validators.DataRequired()]) outageTagId = h5fields.IntegerField('', widget=h5widgets.NumberInput(min=0, step=1), validators=[validators.DataRequired()]) outageType = StringField('', validators=[ validators.DataRequired(), validators.Length(min=1, max=250) ]) outageTag = StringField('', validators=[ validators.DataRequired(), validators.Length(min=1, max=250) ]) elementName = StringField('', validators=[ validators.DataRequired(), validators.Length(min=1, max=500) ]) elementType = StringField('', validators=[ validators.DataRequired(), validators.Length(min=1, max=250) ])
class AddRecord(FlaskForm): artist_name = wt.StringField('Artist Name (Display)') artist_name_sort = wt.StringField('Artist Name (Sort)') album_name = wt.StringField('Album Name') genre = wt.StringField('Genre') ignore = wt5.IntegerField('Ignore?') release_type = wt.StringField('Release Type') submit = wt.SubmitField('Update')
class EditGroupForm(flask_wtf.FlaskForm): name = fields.StringField( _l('Namn'), validators=[validators.InputRequired(), validators.Length(max=50)]) weight = html5_fields.IntegerField( _l('Sorteringsvikt'), description=_l("Heltal. En högre vikt stiger."), validators=[validators.InputRequired()])
class MovmentsForm(Form): from_location = SelectField('Location', choices=[]) to_location = SelectField('Location', choices=[]) product_id = SelectField('Product', choices=[]) timestamp = DateTimeLocalField('Time', format='%m/%d/%y') qyt = h5fields.IntegerField("Number2") # qyt=h5fields Submit = SubmitField('Add')
class UserForm(FlaskForm): username = StringField("Username", validators=[DataRequired()]) # age = StringField("Age", validators=[DataRequired()]) age = h5fields.IntegerField("Age", validators=[DataRequired()]) gender = SelectField("Gender", validators=[DataRequired()], choices=["Female", "Male", "Other"]) tweets_set_to_use = SelectField("Tweet Set", validators=[DataRequired()]) submit = SubmitField("Start")
class AddActorForm(FlaskForm): name = StringField('name', validators=[DataRequired()]) age = h5fields.IntegerField( 'age', widget=h5widgets.NumberInput(min=1, max=100, step=1), validators=[DataRequired()], ) gender = SelectField('gender', validators=[DataRequired()], choices=[('Male', 'Male'), ('Female', 'Female')])
class UserForm(FlaskForm): firstname = StringField('Prénom', validators=[DataRequired()]) lastname = StringField('Nom', validators=[DataRequired()]) birthday = DateField('Date de naissance', validators=[DataRequired()], format="%d/%m/%Y") address = StringField('Adresse', validators=[DataRequired()]) city = StringField('Ville', validators=[DataRequired()]) zipcode = StringField('Code postal', validators=[DataRequired()]) reason = SelectField('Motif', choices=reasons, validators=[DataRequired()]) delay = IntegerField('Délai (minutes)', default=0) delay = h5fields.IntegerField('Délai (minutes)', widget=h5widgets.NumberInput(), default=0) submit = SubmitField('Générer')
class watchForm(quickWatchForm): minutes_between_check = html5.IntegerField('Maximum time in minutes until recheck', [validators.Optional(), validators.NumberRange(min=1)]) css_filter = StringField('CSS/JSON Filter', [ValidateCSSJSONInput()]) title = StringField('Title') ignore_text = StringListField('Ignore Text', [ValidateListRegex()]) notification_urls = StringListField('Notification URL List') headers = StringDictKeyValue('Request Headers') trigger_check = BooleanField('Send test notification on save')
class F(Form): search = html5.SearchField() telephone = html5.TelField() url = html5.URLField() email = html5.EmailField() datetime = html5.DateTimeField() date = html5.DateField() dt_local = html5.DateTimeLocalField() integer = html5.IntegerField() decimal = html5.DecimalField() int_range = html5.IntegerRangeField() decimal_range = html5.DecimalRangeField()
class AddCourseForm(FlaskForm): """ To add a new course to the database """ name = StringField("Name", validators=[DataRequired()]) key = StringField("Einschreibeschluessel") spaces = h5fields.IntegerField("Anzahl freie Plätze", widget=h5widgets.NumberInput(min=1, max=100, step=1), validators=[DataRequired()]) desc = StringField("Beschreibungstext", widget=TextArea()) submit = SubmitField("Erstellen")
class globalSettingsForm(Form): password = SaltyPasswordField() minutes_between_check = html5.IntegerField('Maximum time in minutes until recheck', [validators.NumberRange(min=1)]) notification_urls = StringListField('Notification URL List') extract_title_as_title = BooleanField('Extract <title> from document and use as watch title') trigger_check = BooleanField('Send test notification on save') notification_title = StringField('Notification Title') notification_body = TextAreaField('Notification Body')