class PunchFormAdd(FlaskForm): punch_id = StringField('Id', render_kw={'readonly': True}) punch_closure_c = SelectField('Closure Company', choices=[]) punch_closure_e = SelectField('Closure Employee', choices=[]) punch_status = BooleanField('Closed') punch_system = SelectField(u'System', choices=[]) punch_floor = SelectField(u'Floor', choices=[]) punch_cat = SelectField(u'Category', choices=[]) punch_building = SelectField(u'Building', choices=[]) punch_phase = SelectField(u'Phase', choices=[]) punch_origin_c = SelectField('Originator Company', choices=[]) punch_origin_e = SelectField('Originator Employee', choices=[], validators=[DataRequired()]) punch_supplier = SelectField('Supplier', choices=[]) punch_closed_by = StringField('Closed By') punch_desc = StringField('Description', widget=widgets.TextArea()) punch_comments = StringField('Comments', widget=widgets.TextArea()) punch_orig_date = StringField('Originated', render_kw={'readonly': True}) punch_due_date = StringField('Due') punch_custom1 = StringField('Custom 1') punch_custom2 = StringField('Custom 2') punch_custom3 = StringField('Custom 3') punch_custom4 = StringField('Custom 4') punch_custom5 = StringField('Custom 5') punch_discipline = SelectField('Discipline', choices=[('HVAC', 'HVAC'), ('Civil', 'Civil'), ('Electrical', 'Electrical'), ('Automation', 'Automation'), ('Safety', 'Safety'), ('Equipment', 'Equipment')]) submit = SubmitField('Add')
class ChallengeForm(FlaskForm): name = fields.StringField( "Name", validators=[validators.InputRequired(), validators.Length(min=3)]) description = fields.StringField("Description", validators=[validators.InputRequired()]) problem_statement = fields.StringField( "Problem Statement", validators=[validators.InputRequired()], widget=widgets.TextArea(), ) input_format = fields.StringField("Input Format", widget=widgets.TextArea()) constraints = fields.StringField("Constraints", widget=widgets.TextArea()) output_format = fields.StringField( "Output Format", validators=[validators.InputRequired()], widget=widgets.TextArea(), ) score = fields.IntegerField( "Score", validators=[validators.InputRequired(), validators.NumberRange(min=0)], default=0, ) tags = TagListField( "Tags", validators=[validators.InputRequired(), validators.Length(min=3)])
class EntryForm(Form): """Form for editing/creating an Entry""" title = StringField('title') date = StringField('date', [validate_date]) time_spent = StringField('time_spent') learned = StringField('learned', widget=widgets.TextArea()) resources = StringField('resources', widget=widgets.TextArea())
class JSONField(fields.StringField): """ A text field which stores a `json`. """ widget = widgets.TextArea() def _value(self): return json.dumps(self.data) if self.data else '' def process_formdata(self, valuelist): if valuelist: try: self.data = json.loads(valuelist[0]) except ValueError: self.data = None raise ValueError('This field contains invalid JSON') else: self.data = None def pre_validate(self, form): if self.data: try: json.dumps(self.data) except TypeError: self.data = None raise ValueError('This field contains invalid JSON')
class CompanyFormAdd(FlaskForm): companycode = StringField('Code', validators=[DataRequired()]) companyname = StringField('Name', validators=[DataRequired()]) companytype = SelectField(u'Type', choices=[('Construction Manager', 'Construction Manager'), ('Engineer', 'Engineer'), ('Owner', 'Owner'), ('Contractor', 'Contractor'), ('Subcontractor', 'Subcontractor'), ('Vendor', 'Vendor')]) companyaddress1 = StringField('Address1', validators=[DataRequired()]) companyaddress2 = StringField('Address2') companycity = StringField('City', validators=[DataRequired()]) companycountry = StringField('Country', validators=[DataRequired()]) companydivision = StringField('Division') companynotes = StringField('Notes', widget=widgets.TextArea()) companyemail1 = StringField('Email 1', validators=[Email()]) companyemail2 = StringField('Email 2', validators=[Email()]) companysendmail = BooleanField('Email Open Items Automatically') companyfrequency = SelectField(u'Frequency', choices=[('Hourly', 'Hourly'), ('Daily', 'Daily'), ('Weekly', 'Weekly')]) submit = SubmitField('Add')
class CampaignForm(FlaskForm): campaign_name = StringField( validators=[DataRequired(), Length(min=2, max=20)]) short_description = StringField(validators=[DataRequired()], widget=widgets.TextArea()) start_date = StringField(id='start_date_datepicker', validators=[InputRequired()]) end_date = StringField(id='end_date_datepicker') categories = HiddenField() campaign_images = HiddenField() depicts_metadata = BooleanField() captions_metadata = BooleanField() campaign_type = BooleanField() campaign_image = StringField('Campaign Image') long_description = StringField(widget=widgets.TextArea()) submit = SubmitField()
class ClassForm(FlaskForm): name = fields.StringField( 'Name', validators=[validators.InputRequired(), validators.Length(min=3)]) description = fields.StringField('Description', validators=[validators.InputRequired()], widget=widgets.TextArea()) code = fields.StringField('Code') course = fields.SelectField('Course', validators=[validators.InputRequired()]) limited = fields.BooleanField('Limited Class', default=True) limited_enrollment = fields.FormField(LimitedEnrollmentForm) started_date = fields.DateField( 'Started Date', format='%Y-%m-%d', widget=widgets.TextInput() ) ended_date = fields.DateField( 'Ended Data', format='%Y-%m-%d', widget=widgets.TextInput(), ) # owner = fields.SelectMultipleField('Owner') # contributors = fields.SelectMultipleField('Contributors') tags = TagListField('Tags', validators=[validators.InputRequired(), validators.Length(min=3)])
class ConfigForms(BaseForm): name = simple.StringField(label="配置名称", validators=[DataRequired()], render_kw={'class': 'form-control'}) config = simple.StringField(label="详细配置", widget=widgets.TextArea(), render_kw={ "placeholder": "JSON格式的配置信息", "rows": 10, 'class': 'form-control' }, validators=[DataRequired()]) remark = simple.StringField(label="备注", render_kw={ "placeholder": "可不填写。", 'class': 'form-control' }) def validate_config(self, field): try: json.loads(field.data) except: raise validators.ValidationError("json格式错误" + traceback.format_exc())
class AnnouncementForm(flask_wtf.FlaskForm): announcement_subject = fields.StringField(_('Announcement subject'), [validators.DataRequired()]) announcement_body = fields.StringField(_('Announcement body'), [validators.DataRequired()], widget=widgets.TextArea()) submit = fields.SubmitField(_('Send'))
class RebuildRequestForm(EmptyForm): collection = StrippedStringField('collection') copr_name = StrippedStringField('copr_name', [validators.Length(min=1)]) description = StrippedStringField('description', widget=widgets.TextArea()) schedule_count = IntegerField( 'schedule_count', [validators.NumberRange(min=0)], default=get_config('copr.default_schedule_count'))
class ClientNoteForm(FlaskForm): notes = StringField('notes', widget=widgets.TextArea()) #, height_="48") cancelled = BooleanField('cancelled', default=False) approved = BooleanField('approved', default=True) appt_date = StringField('appt_date') appt_time = StringField('appt_time') intern_id = SelectField('intern_id', coerce=int)
class UserReplyForm(flask_wtf.FlaskForm): reply_enabled = fields.BooleanField(_('Enable automatic reply')) reply_subject = fields.StringField(_('Reply subject')) reply_body = fields.StringField(_('Reply body'), widget=widgets.TextArea()) reply_enddate = fields.html5.DateField(_('End of vacation')) submit = fields.SubmitField(_('Update'))
class OfferForm(UserDetailsForm): # Teaching exp options teaching = RadioField('Do you have any teaching experience?', choices=[('1', 'Yes'), ('0', 'No')], validators=[DataRequired()]) teaching_exp = StringField('What teaching experience do you have?') teaching_help = RadioField( 'Would you be interested in helping other volunteers?', choices=[('1', 'Yes'), ('0', 'No')], validators=[DataRequired()]) # Volunteering options help_type = MultiCheckboxField('Commnication style', choices=[('video', 'Video calls'), ('resources', 'Making/providing resources')], validators=[DataRequired()]) help_freq = MultiCheckboxField('Frequency', choices=[('one', 'One-off'), ('many', 'Regular')], validators=[DataRequired()]) other_subjects = StringField('Pop your languages and other subjects here.') enrichment = StringField( 'If you have a particular project that you\'d love to talk about, or anything else to add, pop it here.', widget=widgets.TextArea())
class WebUrlForm(BaseForm): handlemod = core.RadioField(label='选择操作类型', choices=( (1, '恢复链接'), (2, '删除链接'), ), validators=[DataRequired()], coerce=int) weburls = simple.StringField( label="链接地址", widget=widgets.TextArea(), render_kw={ "placeholder": "输入页面url地址以换行分隔", "rows": 10, 'class': 'form-control' }, validators=[DataRequired()], ) imagexpath = simple.StringField(label="获取图片的xpath规则", widget=widgets.TextInput(), render_kw={ "placeholder": "爬取图片的xpath规则,不懂可以不填", "value": "//center//img/@src", 'class': 'form-control' }) pages = BooleanField(label="是否关联分页") remark = simple.StringField(label="备注", widget=widgets.TextInput(), render_kw={ "placeholder": "本次操作说明,可不填写。", 'class': 'form-control' })
class CreateForm(FlaskForm): title = fields.StringField('title', validators=[validators.DataRequired()]) email = fields.StringField('email', validators=[validators.Email(), validators.Optional()]) image_url = fields.StringField('image-url', validators=[validators.URL(), validators.Optional()]) description = fields.StringField('description', widget=widgets.TextArea(), validators=[validators.DataRequired()]) private = fields.BooleanField('privat', validators=[validators.Optional()]) submit = fields.SubmitField(label='Create')
class StringDictKeyValue(StringField): widget = widgets.TextArea() def _value(self): if self.data: output = u'' for k in self.data.keys(): output += "{}: {}\r\n".format(k, self.data[k]) return output else: return u'' # incoming def process_formdata(self, valuelist): if valuelist: self.data = {} # Remove empty strings cleaned = list(filter(None, valuelist[0].split("\n"))) for s in cleaned: parts = s.strip().split(':') if len(parts) == 2: self.data.update({parts[0].strip(): parts[1].strip()}) else: self.data = {}
class UserInfoForm(FlaskForm): first_name = StringField('first_name', default='First Name') last_name = StringField('last_name', default='Last Name') email = StringField('email') role_id = SelectField('role_id', coerce=int) calendar_access = BooleanField('cal_access', default=False) therapist_id = SelectField('therapist_id', coerce=int) signature = StringField('signature', widget=widgets.TextArea())
class ContactForm(Form): name = StringField('Full Name', validators=[DataRequired()]) subject = StringField('Subject', validators=[DataRequired()]) email = EmailField('Email Address', validators=[DataRequired(), Email()]) phone = StringField('Phone Number', validators=[DataRequired()]) body = StringField('Message', validators=[DataRequired()], widget=widgets.TextArea()) user_id = IntegerField('User', validators=[Optional()])
class LoginForm(Form): name = simple.StringField( validators=[ # 验证 validators.DataRequired(message='用户名不能为空'), validators.length(min=6, max=18, message='用户名长度必须大于6小于18') ], widget=widgets.TextArea(), # 插件 render_kw={'placeholder': '请输入用户名'}, )
class RoomAdminForm(Form): def __init__(self, *args, **kwargs): super(RoomAdminForm, self).__init__(*args, **kwargs) self.hotel_id.choices = [(str(f.id), str(f)) for f in session.query(Hotel).all()] hotel_id = SelectField("Отель", validators=[DataRequired()]) title = StringField("Название", validators=[DataRequired()]) description = StringField("Краткое описание", widget=widgets.TextArea())
class ComplaintForm(Form): name = StringField('Full Name', validators=[DataRequired()]) email = EmailField('Email Address', validators=[DataRequired(), Email()]) phone = StringField('Phone Number', validators=[Optional()]) reason = StringField('Reason', validators=[DataRequired()], widget=widgets.TextArea()) captcha = RecaptchaField(public_key=app.config.get("RECAPTCHA_PUB_KEY"), private_key=app.config.get("RECAPTCHA_PRIV_KEY"), secure=True)
class MessageForm(Form): user_id = IntegerField('User', validators=[Optional()]) product_id = IntegerField('Product', validators=[DataRequired()]) name = StringField("Name", validators=[DataRequired()]) email = EmailField("Email", validators=[DataRequired(), Email()]) phone = StringField("Phone", validators=[DataRequired()]) subject = StringField("Subject", validators=[Optional()]) body = StringField("Body", validators=[Optional()], widget=widgets.TextArea()) # for plain text messages
class FlushCDNFORM(BaseForm): imageurls = simple.StringField( label="刷新CND图片或目录地址", widget=widgets.TextArea(), render_kw={ "placeholder": "输入图片或目录url地址以换行分隔", "rows": 10, 'class': 'form-control' }, validators=[DataRequired()], )
class ProductReviewForm(Form): user_id = IntegerField('User', validators=[DataRequired()]) product_id = IntegerField('Product', validators=[DataRequired()]) subject = StringField('Subject', validators=[DataRequired()]) message = StringField('Message', validators=[DataRequired()], widget=widgets.TextArea()) rating = SelectField('Rating', coerce=int, choices=[(1, 1), (2, 2), (3, 3), (4, 4), (5, 5)], validators=[DataRequired()])
class UserForm(FlaskForm): first_name = StringField('First Name') last_name = StringField('Last Name') email = StringField('Email', validators=[DataRequired(), Email()]) username = StringField('Username', validators=[DataRequired()]) location = StringField('Location') bio = StringField('Bio', validators=[Length(max=100)], widget=widgets.TextArea()) image_url = StringField('Profile Picture') header_image_url = StringField('Header Image') password = PasswordField('password', validators=[Length(min=6)])
class Meta: model = Meeting field_args = { 'venue_address': { 'widget': widgets.TextArea() }, 'date_start': { 'format': '%d.%m.%Y', }, 'date_end': { 'format': '%d.%m.%Y', } }
class form_class(form.Form): network = fields.StringField(widget=widgets.TextArea()) normalize = fields.BooleanField(label="Normalize weights") qualabel = fields.BooleanField(label="Include quality in label") predlabel = fields.BooleanField(label="Include predicate in label") collapse = fields.BooleanField(label="Collapse arrows between nodes") nosubgraphs = fields.BooleanField( label="Don't make subgraphs per source") #blue = fields.BooleanField() #bw = fields.BooleanField(label="Black & White") delimiter = fields.SelectField( choices=[("", "autodetect"), (";", ";"), (",", ","), ("\t", "tab")])
class CsvTextAreaField(Field): widget = widgets.TextArea() def _value(self): if self.data: return u', '.join(self.data) else: return u'' def process_formdata(self, valuelist): if valuelist: self.data = [v.strip() for v in valuelist[0].split(',')] else: self.data = []
class AutosqliForm(FlaskForm): test_url = fields.StringField( label="TEST URL:", validators=[ validators.DataRequired(message='URL不能为空'), validators.URL(require_tld=False, message='url不正确') ], widget = widgets.TextInput(), render_kw={ "class": "form-control", "placeholder": "请输入URL", "required": "", "autofocus": "" } ) request_method = fields.RadioField( label="请求方法", validators=[ validators.DataRequired(message='请选择请求方法'), ], choices=[('get', "GET"),('post','POST')], default='post' ) request_params = fields.TextAreaField( label='请求参数', validators=[ validators.DataRequired(message='请求参数不能为空') ], widget=widgets.TextArea(), render_kw={ 'class':'form-control', 'required':'', 'rows':6 } ) ignore_params = fields.StringField( label='忽略注入字段', widget=widgets.TextInput(), render_kw={ 'class':'form-control', 'placeholder':'输入不要检测的字段名' } )
class ClientInfoForm(FlaskForm): first_name = StringField('first_name', validators=[DataRequired()]) last_name = StringField('last_name', validators=[DataRequired()]) birthdate = StringField('birthdate', validators=[DataRequired()]) uci_id = StringField('uci_id', validators=[DataRequired()]) address = StringField('address', validators=[DataRequired()]) city = StringField('city', validators=[DataRequired()]) state = StringField('state', validators=[DataRequired()], default='CA') zipcode = StringField('zipcode', validators=[DataRequired()]) phone = StringField('phone', validators=[DataRequired()]) additional_info = StringField('additional_info', widget=widgets.TextArea()) regional_center_id = SelectField('regional_center_id', coerce=int, validators=[DataRequired()]) case_worker_id = SelectField('case_worker_id', coerce=int, validators=[DataRequired()]) therapist_id = SelectField('therapist_id', coerce=int, validators=[DataRequired()]) gender = SelectField('gender', choices=[('M', 'Male'), ('F','Female')], validators=[DataRequired()])