class PostForm(Form): text = StringField('Text', validators=[DataRequired()], widget=TextArea())
class PostForm(FlaskForm): title = StringField('Title', validators=[DataRequired()]) content = StringField('Content', validators=[DataRequired()], widget=TextArea()) tags = StringField('Tag', validators=[DataRequired()]) submit = SubmitField('Add Post')
class PostForm(FlaskForm): title = StringField('title', validators=[DataRequired()], render_kw={'placeholder': 'Post title'}) summary = StringField('summary', validators=[DataRequired()], render_kw={'placeholder': 'Post Summary'}) content = StringField('content', validators=[DataRequired()], widget=TextArea(), render_kw={'placeholder': 'Post content'})
def __init__(self, textarea=False): super(SyncedInputWidget, self).__init__('forms/synced_input_widget.html', single_line=not textarea) self.textarea = textarea self.default_widget = TextArea() if textarea else TextInput()
class TemplateUpdateForm(FlaskForm): ftemplate_name = StringField('Name:', validators=[DataRequired()]) ftemplate_data = StringField('TemplateData:', widget=TextArea(), validators=[DataRequired()])
class ArtistForm(Form): name = StringField('name', validators=[DataRequired(), Length(min=3, max=30)]) city = StringField('city', validators=[DataRequired(), Length(min=3, max=30)]) 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'), ]) phone = StringField( # TODO implement validation logic for state 'phone', validators=[DataRequired(), Length(min=10, max=12)]) image_link = StringField('image_link', validators=[URL(), optional()]) genres = SelectMultipleField( # TODO implement enum restriction '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'), ]) website = StringField( # TODO implement enum restriction 'website', validators=[URL(), optional()]) facebook_link = StringField( # TODO implement enum restriction 'facebook_link', validators=[URL(), optional()]) seeking_venue = RadioField('seeking_venue', validators=[DataRequired()], choices=[('Yes', 'Yes'), ('No', 'No')], default='No') seeking_description = StringField('seeking_description', validators=[Length(min=10), optional()], default='', widget=TextArea())
class NetconfForm(ConnectionForm): form_type = HiddenField(default="netconf_service") nc_type = SelectField( choices=( ("get_config", "Get Full Config"), ("get_filtered_config", "Get"), ("push_config", "Edit Config"), ("copy_config", "Copy Config"), ("rpc", "Dispatch"), ), label="NETCONF Operation", ) xml_filter = StringField(label="XML Filter", widget=TextArea(), render_kw={"rows": 5}, substitution=True) target = SelectField( choices=( ("running", "Running"), ("candidate", "Candidate"), ("startup", "Startup"), ), label="Target Config", ) default_operation = SelectField( choices=( ("merge", "Merge"), ("replace", "Replace"), ("None", "None"), ), label="Default config operation", validate_choice=False, ) test_option = SelectField( choices=( ("test-then-set", "Test, then set"), ("set", "Set"), ("None", "None"), ), label="Config test option", validate_choice=False, ) error_option = SelectField( choices=( ("stop-on-error", "Stop on error"), ("continue-on-error", "Continue on error"), ("rollback-on-error", "Rollback on error"), ("None", "None"), ), label="Error option", validate_choice=False, ) lock = BooleanField(label="Lock target") unlock = BooleanField(label="Unlock target") copy_source = SelectField( choices=( ("running", "Running"), ("candidate", "Candidate"), ("startup", "Startup"), ("source_url", "Source URL"), ), label="Copy Source", validate_choice=False, ) source_url = StringField( label="Copy source URL", widget=TextArea(), render_kw={"rows": 1}, substitution=True, ) copy_destination = SelectField( choices=( ("running", "Running"), ("candidate", "Candidate"), ("startup", "Startup"), ("destination_url", "Destination URL"), ), label="Copy Destination", validate_choice=False, ) destination_url = StringField( label="Copy destination URL", widget=TextArea(), render_kw={"rows": 1}, substitution=True, ) commit_conf = BooleanField(label="Commit") timeout = IntegerField(default=15) xml_conversion = BooleanField(label="Convert XML result to dictionary", default=True) @classmethod def form_init(cls): parameters = { "get_config": ["target", "xml_conversion"], "get_filtered_config": [ "target", "xml_filter", "xml_conversion", ], "push_config": [ "target", "xml_filter", "default_operation", "test_option", "error_option", "lock", "unlock", "commit_conf", "xml_conversion", ], "copy_config": [ "copy_source", "source_url", "copy_destination", "destination_url", "commit_conf", "xml_conversion", ], "rpc": ["xml_filter", "xml_conversion"], } list_parameters = list(set(sum(parameters.values(), []))) cls.groups = { "NETCONF Parameters": { "commands": ["nc_type"] + list_parameters, "default": "expanded", }, **ConnectionForm.groups, } cls.input_data = HiddenField( "", default=dumps({ "fields": list_parameters, "netconf_type": parameters }), )
class UComplaintForm(FlaskForm): hostel = SelectField(u"Hostel:", choices=[('Himalaya','HIMALAYA'),('Shivalik','SHIVALIK')]) to = SelectField(u"To:", choices=[('Warden','WARDEN'),('Attendant','ATTENDANT'),('Admin','ADMIN')]) title = StringField("Title:", validators=[DataRequired(), Length(max=30, message="Title too long!")], widget=TextArea()) content = StringField("Content:", validators=[DataRequired(), Length(max=500, message="Limit to 500 words only!")], widget=TextArea()) update = SubmitField('Update')
class UAnnouncementForm(FlaskForm): hostel = SelectField(u"Hostel:", choices=[('','---'),('Himalaya','HIMALAYA'),('Shivalik','SHIVALIK')]) type = SelectField(u"Type:", choices=[('','---'),('General','GENERAL'),('Mess','MESS'),('Fees','FEES')]) title = StringField("Title:", validators=[DataRequired(), Length(max=30, message="Title too long!")], widget=TextArea()) content = StringField("Content:", validators=[DataRequired(), Length(max=500, message="Limit to 500 words only!")], widget=TextArea()) submit = SubmitField('Update')