class BusinessForm(AfterLoginForm): name = StringField("Name", validators=[ InputRequired(), Length(2, 15, "Name does not respect our rules.") ]) description = StringField("Description", widget=TextArea()) fiscal_number = StringField( "Fiscal number", validators=[InputRequired(), Length(8, 15, "Tax number isn't valid.")]) phone = StringField("Phone", validators=[ InputRequired(), Length(6, 20, "Phone number isn't valid.") ]) mobile = StringField("Mobile", validators=[ InputRequired(), Length(6, 20, "Mobile number isn't valid.") ]) def get_areas(): query = db.execute("SELECT id, designation FROM businessAreas") sectors = list() for value in query: sectors.append((value["id"], value["designation"])) return sectors activity_sector = SelectField("Sector", choices=get_areas())
def test_textarea(self, basic_widget_dummy_field): # Make sure textareas escape properly and render properly setattr(basic_widget_dummy_field, "data", "hi<>bye") setattr(basic_widget_dummy_field, "name", "f") setattr(basic_widget_dummy_field, "id", "") assert (TextArea()(basic_widget_dummy_field) == '<textarea id="" name="f">\r\nhi<>bye</textarea>')
def test_textarea(self, basic_widget_dummy_field): # Make sure textareas escape properly and render properly basic_widget_dummy_field.data = "hi<>bye" basic_widget_dummy_field.name = "f" basic_widget_dummy_field.id = "" assert (TextArea()(basic_widget_dummy_field) == '<textarea id="" name="f">\r\nhi<>bye</textarea>')
class Graph_form(Form): id_key = StringField('Id key', default='id', validators=[validators.Length(min=1, max=25)]) x_axis = StringField('X axis key', default='key', validators=[validators.Length(min=1, max=25)]) y_axis = StringField('Y axis key', default='value', validators=[validators.Length(min=1, max=25)]) hue_key = StringField('Hue (farge) key', default='time', validators=[validators.Length(min=1, max=25)]) yellow_hline = IntegerField('Yellow hline', validators=[ validators.Optional(), validators.NumberRange(min=-999999, max=999999) ]) red_hline = IntegerField('Red hline', validators=[ validators.Optional(), validators.NumberRange(min=-999999, max=999999) ]) excel_field = StringField( 'Excel Paste', widget=TextArea(), default= 'id\tvalue\ttime\tkey\n1\t71\tt1\tsos\n2\t62\tt1\temo\n3\t82\tt1\thyp\n4\t73\tt2\tsos\n5\t94\tt2\temo\n6\t52\tt2\thyp' )
class Pre_questionnaire_form(Form): age = IntegerField(default=99) questionnaire = SelectField('sdq, Eiberg or RCADS', choices=['SDQ', 'RCADS', 'Eiberg']) shuffle_list = ['0'] * 20 + ['1'] * 20 + ['2'] * 5 + ['3'] * 2 shuffle(shuffle_list) excel_field = StringField('Excel Paste', widget=TextArea(), default='\t'.join(shuffle_list))
class CanonItemForm(FlaskForm): title = StripStringField(validators=[InputRequired()]) excerpt = TextAreaField() body = TextAreaField() tags = SeparatedField() question_links = SeparatedField('Questions', pattern=r'[\r\n]+', separator='\n', sort=True, widget=TextArea())
class EntryEditForm(FlaskForm): title = StringField('Title', validators=[ DataRequired(), Regexp(r'^[a-zA-Z0-9_ ]+$', message=("Title should include ", "letters and numbers only")) ]) date = DateField('Date', format='%Y-%m-%d', validators=[DataRequired()]) timeSpent = IntegerField('Time Spent', validators=[DataRequired()]) whatILearned = TextAreaField('What I Learned', widget=TextArea(), validators=[DataRequired()]) ResourcesToRemember = TextAreaField( 'Resources To Remember', widget=TextArea(), validators=[DataRequired()], description="Enter each resource on a new line") tags = TagField('Tags', description="Separate Multiple tags with commans.")
class BusinessAccountForm(CustomerAccountForm, AccountForm): name = StringField("Name", validators=[ InputRequired(), Length(2, 15, "Name does not respect our rules.") ]) description = StringField("Description", widget=TextArea()) phone = StringField("Phone", validators=[ InputRequired(), Length(6, 20, "Phone number isn't valid.") ]) mobile = StringField("Mobile", validators=[ InputRequired(), Length(6, 20, "Mobile number isn't valid.") ])
class HandoutForm(FlaskForm): campaign_id = IntegerField(widget=HiddenInput(), validators=[DataRequired()]) title = StringField('Title', validators=[DataRequired()]) content = StringField('Content', widget=TextArea()) status = EnumField('Status', choices=[(e.name, e.value) for e in HandoutStatus], default=HandoutStatus.draft) group_id = SelectField('Group', choices=[ ('', '(none)'), ], default='', validate_choice=False) submit = SubmitField('Save handout')
class AddNoteForm(FlaskForm): title = StringField('Title', validators=[DataRequired()]) content = TextAreaField('Content', widget=TextArea()) submit = SubmitField('Register')
class EditForm(CreateForm): id = IntegerField(widget=HiddenInput()) description = StringField('Description', widget=TextArea()) submit = SubmitField('Save')
class PostFormEx(Form): title = StringField(u'title', validators=[Required()]) body = StringField(u'Text', widget=TextArea())
class VenueForm(Form): name = StringField('name', validators=[DataRequired()]) city = StringField('city', validators=[DataRequired()]) state = SelectField('state', validators=[DataRequired()], choices=[ ('AL', 'AL'), ('AK', 'AK'), ('AZ', 'AZ'), ('AR', 'AR'), ('CA', 'CA'), ('CO', 'CO'), ('CT', 'CT'), ('DE', 'DE'), ('DC', 'DC'), ('FL', 'FL'), ('GA', 'GA'), ('HI', 'HI'), ('ID', 'ID'), ('IL', 'IL'), ('IN', 'IN'), ('IA', 'IA'), ('KS', 'KS'), ('KY', 'KY'), ('LA', 'LA'), ('ME', 'ME'), ('MT', 'MT'), ('NE', 'NE'), ('NV', 'NV'), ('NH', 'NH'), ('NJ', 'NJ'), ('NM', 'NM'), ('NY', 'NY'), ('NC', 'NC'), ('ND', 'ND'), ('OH', 'OH'), ('OK', 'OK'), ('OR', 'OR'), ('MD', 'MD'), ('MA', 'MA'), ('MI', 'MI'), ('MN', 'MN'), ('MS', 'MS'), ('MO', 'MO'), ('PA', 'PA'), ('RI', 'RI'), ('SC', 'SC'), ('SD', 'SD'), ('TN', 'TN'), ('TX', 'TX'), ('UT', 'UT'), ('VT', 'VT'), ('VA', 'VA'), ('WA', 'WA'), ('WV', 'WV'), ('WI', 'WI'), ('WY', 'WY'), ]) address = StringField('address', validators=[DataRequired()]) phone = StringField('phone') def validate_phone(form, field): value = field.data print(value) if not re.search("^[0-9-]*$", value): msg = u"Invalid phone number." raise ValidationError(msg) image_link = StringField('image_link') genres = SelectMultipleField('genres', validators=[DataRequired()], choices=[ ('Alternative', 'Alternative'), ('Blues', 'Blues'), ('Classical', 'Classical'), ('Country', 'Country'), ('Electronic', 'Electronic'), ('Folk', 'Folk'), ('Funk', 'Funk'), ('Hip-Hop', 'Hip-Hop'), ('Heavy Metal', 'Heavy Metal'), ('Instrumental', 'Instrumental'), ('Jazz', 'Jazz'), ('Musical Theatre', 'Musical Theatre'), ('Pop', 'Pop'), ('Punk', 'Punk'), ('R&B', 'R&B'), ('Reggae', 'Reggae'), ('Rock n Roll', 'Rock n Roll'), ('Soul', 'Soul'), ('Other', 'Other'), ]) facebook_link = StringField('facebook_link', validators=[URL()]) website = StringField('website', validators=[URL()]) image_link = StringField('image_link', validators=[URL()]) seeking_talent = StringField('seeking_talent', widget=CheckboxInput()) seeking_description = StringField('seeking_description', widget=TextArea())
class CommentForm(FlaskForm): comment = StringField('comment', widget=TextArea(), validators=[InputRequired()])
class NewDiscussionForm(FlaskForm): title = StringField('title', validators=[InputRequired(), Length(max=60)]) description = StringField('description', validators=[Length(max=60)]) content = StringField('content', widget=TextArea(), validators=[InputRequired()])