class ResultForm(FlaskForm): pairingIdentifier = HiddenField() matchNumber = HiddenField() blackResultSelector = SelectField("Black Result", choices = [["", ""], ["W", "Win"], ["D", "Draw"], ["L", "Lose"], ["NS", "No Show"]], validators = [DataRequired(message = "This is a required field.")]) whiteResultSelector = SelectField("White Result", choices = [["", ""], ["W", "Win"], ["D", "Draw"], ["L", "Lose"], ["NS", "No Show"]], validators = [DataRequired(message = "This is a required field.")]) submitButton = SubmitField("Submit")
class EditCustomerForm(CreateCustomerForm): user_id = HiddenField('User ID') # Physical Exam blood_pressure_systolic = StringField('Blood Pressure Systolic') blood_pressure_diastolic = StringField('Blood Pressure Diastolic') heart_rate = StringField('Heart Rate') height = StringField('Height') weight = StringField('Weight') bmi = StringField('BMI') access_code = StringField('Access Code') # Medications medication_name_0 = StringField('Medication Name') medication_name_1 = StringField('Medication Name') medication_name_2 = StringField('Medication Name') medication_name_3 = StringField('Medication Name') medication_name_4 = StringField('Medication Name') medication_name_5 = StringField('Medication Name') medication_name_6 = StringField('Medication Name') medication_name_7 = StringField('Medication Name') medication_name_8 = StringField('Medication Name') medication_name_9 = StringField('Medication Name') medication_dose_0 = StringField('Medication Dosage') medication_dose_1 = StringField('Medication Dosage') medication_dose_2 = StringField('Medication Dosage') medication_dose_3 = StringField('Medication Dosage') medication_dose_4 = StringField('Medication Dosage') medication_dose_5 = StringField('Medication Dosage') medication_dose_6 = StringField('Medication Dosage') medication_dose_7 = StringField('Medication Dosage') medication_dose_8 = StringField('Medication Dosage') medication_dose_9 = StringField('Medication Dosage') medication_freq_0 = StringField('Medication Frequency') medication_freq_1 = StringField('Medication Frequency') medication_freq_2 = StringField('Medication Frequency') medication_freq_3 = StringField('Medication Frequency') medication_freq_4 = StringField('Medication Frequency') medication_freq_5 = StringField('Medication Frequency') medication_freq_6 = StringField('Medication Frequency') medication_freq_7 = StringField('Medication Frequency') medication_freq_8 = StringField('Medication Frequency') medication_freq_9 = StringField('Medication Frequency') # Medical / Lifestyle History current_problems_0 = StringField('Current Problems') current_problems_1 = StringField('Current Problems') current_problems_2 = StringField('Current Problems') current_problems_3 = StringField('Current Problems') current_problems_4 = StringField('Current Problems') current_problems_5 = StringField('Current Problems') current_problems_6 = StringField('Current Problems') current_problems_7 = StringField('Current Problems') current_problems_8 = StringField('Current Problems') current_problems_9 = StringField('Current Problems') gender = SelectField('Gender', choices=GENDER) blood_type = SelectField('Blood Type', choices=BLOOD_TYPE) patient_preferences = TextAreaField('Patient Preferences') patient_consents = TextAreaField('Emergency Contact') family_history = TextAreaField('Family History') lifestyle_history = TextAreaField('Lifestyle') social_history = TextAreaField('Social History') care_plan = TextAreaField('Care Plan') lab_results = TextAreaField('Recent Lab Results') referrals = TextAreaField('Referrals') allergies = TextAreaField('Precautions, Alergies, and Alerts') # Subscription Status active = SelectField('Account Active?', choices=[('true', ' Yes '), ('false', ' No ')]) status = SelectField('Account Status', choices=SUB_STATUS) # Dental History dentist_name = StringField('Dentist Name') dentist_phone = StringField('Dentist Phone') dentist_email = StringField('Dentist Email') dental_condition = TextAreaField('Current Dental Condition') # Dental Insurance ins_planid_dental = StringField('Insurance Plan ID') ins_provider_dental = StringField('Insurance Provider') ins_street_addr_dental = StringField('Dental Insurance Street Address') ins_city_dental = StringField('Dental Insurance City') ins_state_dental = StringField('Dental Insurance State') ins_zipcode_dental = StringField('Dental Insurance ZIP') ins_phone_dental = StringField('Dental Insurance Phone') ins_email_dental = StringField('Dental Insurance Email') # Medical Insurance ins_planid_med = StringField('Insurance Plan ID') ins_provider_med = StringField('Insurance Provider') ins_street_addr_med = StringField('Street Address') ins_city_med = StringField('City') ins_state_med = StringField('State') ins_zipcode_med = StringField('ZIP') ins_phone_med = StringField('Phone') ins_email_med = StringField('Email') img_submit = SubmitField('Upload')
class UpdateShow(FlaskForm): show_id = HiddenField('', validators=[DataRequired()]) season = IntegerField('Episodes') eps_watched = IntegerField('Episodes') submit = SubmitField('⟳')
class NapalmBackupForm(NapalmForm): form_type = HiddenField(default="napalm_backup_service") configuration_getters = SelectMultipleField(choices=( ("get_arp_table", "ARP table"), ("get_interfaces_counters", "Interfaces counters"), ("get_facts", "Facts"), ("get_environment", "Environment"), ("get_config", "Configuration"), ("get_interfaces", "Interfaces"), ("get_interfaces_ip", "Interface IP"), ("get_lldp_neighbors", "LLDP neighbors"), ("get_lldp_neighbors_detail", "LLDP neighbors detail"), ("get_mac_address_table", "MAC address"), ("get_ntp_servers", "NTP servers"), ("get_ntp_stats", "NTP statistics"), ("get_optics", "Transceivers"), ("get_snmp_information", "SNMP"), ("get_users", "Users"), ("get_network_instances", "Network instances (VRF)"), ("get_ntp_peers", "NTP peers"), ("get_bgp_config", "BGP configuration"), ("get_bgp_neighbors", "BGP neighbors"), ("get_ipv6_neighbors_table", "IPv6"), ("is_alive", "Is alive"), )) operational_data_getters = SelectMultipleField(choices=( ("get_arp_table", "ARP table"), ("get_interfaces_counters", "Interfaces counters"), ("get_facts", "Facts"), ("get_environment", "Environment"), ("get_config", "Configuration"), ("get_interfaces", "Interfaces"), ("get_interfaces_ip", "Interface IP"), ("get_lldp_neighbors", "LLDP neighbors"), ("get_lldp_neighbors_detail", "LLDP neighbors detail"), ("get_mac_address_table", "MAC address"), ("get_ntp_servers", "NTP servers"), ("get_ntp_stats", "NTP statistics"), ("get_optics", "Transceivers"), ("get_snmp_information", "SNMP"), ("get_users", "Users"), ("get_network_instances", "Network instances (VRF)"), ("get_ntp_peers", "NTP peers"), ("get_bgp_config", "BGP configuration"), ("get_bgp_neighbors", "BGP neighbors"), ("get_ipv6_neighbors_table", "IPv6"), ("is_alive", "Is alive"), )) replacements = FieldList(FormField(ReplacementForm), min_entries=3) groups = { "Create Configuration File": { "commands": ["configuration_getters"], "default": "expanded", }, "Create Operational Data File": { "commands": ["operational_data_getters"], "default": "expanded", }, "Search Response & Replace": { "commands": ["replacements"], "default": "expanded", }, **NapalmForm.groups, }
class CropAvatarForm(FlaskForm): x = HiddenField() y = HiddenField() w = HiddenField() h = HiddenField() submit = SubmitField('Crop and Update')
class DeletePosterForm(FlaskForm): id = HiddenField('') action = HiddenField('') eliminar = SubmitField('Eliminar')
class QuickSearchForm(FlaskForm): query = StringField('Query', [validators.required()]) search_threads = HiddenField('Threads', default='checked') search_messages = HiddenField('Messages', default='checked') submit = SubmitField('Search', [validators.optional()])
class LoginForm(FlaskForm): next = HiddenField() # for login.html reg_next = HiddenField() # for login_or_register.html username = StringField(_('Username'), validators=[ validators.DataRequired( _('Username is required')), ]) email = StringField(_('Email'), validators=[ validators.DataRequired(_('Email is required')), validators.Email(_('Invalid Email')) ]) password = PasswordField(_('Password'), validators=[ validators.DataRequired( _('Password is required')), ]) remember_me = BooleanField(_('Remember me')) submit = SubmitField(_('Sign in')) def __init__(self, *args, **kwargs): super(LoginForm, self).__init__(*args, **kwargs) user_manager = current_app.user_manager if user_manager.enable_username and user_manager.enable_email: # Renamed 'Username' label to 'Username or Email' self.username.label.text = _('Username or Email') def validate(self): # Remove fields depending on configuration user_manager = current_app.user_manager if user_manager.enable_username: delattr(self, 'email') else: delattr(self, 'username') # Validate field-validators if not super(LoginForm, self).validate(): return False # Find user by username and/or email user = None user_email = None if user_manager.enable_username: # Find user by username user = user_manager.find_user_by_username(self.username.data) # Find user by email address (username field) if not user and user_manager.enable_email: user, user_email = user_manager.find_user_by_email( self.username.data) else: # Find user by email address (email field) user, user_email = user_manager.find_user_by_email(self.email.data) # Handle successful authentication if user and user_manager.get_password( user) and user_manager.verify_password(self.password.data, user): return True # Successful authentication # Handle unsuccessful authentication # Email, Username or Email/Username depending on settings if user_manager.enable_username and user_manager.enable_email: username_or_email_field = self.username username_or_email_text = (_('Username/Email')) elif user_manager.enable_username: username_or_email_field = self.username username_or_email_text = (_('Username')) else: username_or_email_field = self.email username_or_email_text = (_('Email')) # Show 'username/email does not exist error message if user_manager.show_username_email_does_not_exist: if not user: message = _('%(username_or_email)s does not exist', username_or_email=username_or_email_text) username_or_email_field.errors.append(message) else: self.password.errors.append(_('Incorrect Password')) # Hide 'username/email does not exist error message for additional security else: message = _('Incorrect %(username_or_email)s and/or Password', username_or_email=username_or_email_text) username_or_email_field.errors.append(message) self.password.errors.append(message) return False # Unsuccessful authentication
class RegisterForm(FlaskForm): password_validator_added = False next = HiddenField() # for login_or_register.html reg_next = HiddenField() # for register.html username = StringField(_('Username'), validators=[ validators.DataRequired( _('Username is required')), unique_username_validator ]) email = StringField(_('Email'), validators=[ validators.DataRequired(_('Email is required')), validators.Email(_('Invalid Email')), unique_email_validator ]) password = PasswordField( _('Password'), validators=[validators.DataRequired(_('Password is required'))]) retype_password = PasswordField( _('Retype Password'), validators=[ validators.EqualTo( 'password', message=_('Password and Retype Password did not match')) ]) invite_token = HiddenField(_('Token')) submit = SubmitField(_('Register')) def validate(self): # remove certain form fields depending on user manager config user_manager = current_app.user_manager if not user_manager.enable_username: delattr(self, 'username') if not user_manager.enable_email: delattr(self, 'email') if not user_manager.enable_retype_password: delattr(self, 'retype_password') # Add custom username validator if needed if user_manager.enable_username: has_been_added = False for v in self.username.validators: if v == user_manager.username_validator: has_been_added = True if not has_been_added: self.username.validators.append( user_manager.username_validator) # Add custom password validator if needed has_been_added = False for v in self.password.validators: if v == user_manager.password_validator: has_been_added = True if not has_been_added: self.password.validators.append(user_manager.password_validator) # Validate field-validators if not super(RegisterForm, self).validate(): return False # All is well return True
class MessageForm(FlaskForm): recipient = SelectMultipleField("To", validators=[Required()], coerce=int) body = TextAreaField("Message", validators=[DataRequired()]) requestReferrer = HiddenField() submit = SubmitField("Save")
class MissingMediaForm(FlaskForm): channel=HiddenField('channel') txdate=HiddenField('txdate') formname=HiddenField('formname') submit=SubmitField('Check again...')
class SkillForm(Form): skill_id = HiddenField() skill = TextField('Enter your skills', validators=[ validators.Length(min = 2, message=(u'The skill should should have at least 2 characters')) ])
class setReviewerForm(FlaskForm): id = HiddenField("id") reviewer = SelectField('Reviewer', choices=[], validators=[DataRequired()]) submit = SubmitField('Set Reviewer')
class UpdateDeadlineForm(FlaskForm): id = HiddenField("id") name = StringField('Deadline Name', validators=[DataRequired()]) deadlinedate = DateField('Deadline Date', format='%Y-%m-%d') submit = SubmitField('Update')
class ValidateUserForm(FlaskForm): user = HiddenField('') action = HiddenField('') validate = SubmitField('Validar') deny = SubmitField('Denegar')
class dummyForm(FlaskForm): dummy_field = HiddenField("Field 1")
class ValidatePosterForm(FlaskForm): id = HiddenField('') action = HiddenField('') validate = SubmitField('Validar') deny = SubmitField('Denegar')
class MethodCreate(FlaskForm): name = StringField(lazy_gettext(u'Name')) method_type = StringField(lazy_gettext(u'Method Type')) controller_type = HiddenField('Controller Type') Submit = SubmitField(lazy_gettext(u'Create New Method'))
class LikeForm(FlaskForm): id = HiddenField('') like = SubmitField('Like')
class updateTmiTeacherReviewForm(FlaskForm): classMembers = FieldList(FormField(updateStudentAttendanceForm)) teacherName = SelectField("Teacher", coerce=str) updateFiltersFlag = HiddenField()
class monthswitchForm(FlaskForm): dec=SubmitField("<") inc=SubmitField(">") value=HiddenField('dec')
class RoomForm(FlaskForm): id = HiddenField('id') name = StringField('name', validators=[InputRequired()])
class AdminCommentForm(CommentForm): author = HiddenField() email = HiddenField() site = HiddenField()
class DeviceAutomationForm(FlaskForm): list_fields = HiddenField(default='jobs') jobs = MultipleObjectField('Job')
class ArticleForm(FlaskForm): title = StringField("Title", validators=[InputRequired()]) content = TextAreaField("Content", validators=[InputRequired()]) html_render = HiddenField()
class PoolObjectsForm(FlaskForm): list_fields = HiddenField(default='devices,links') devices = MultipleObjectField('Device') links = MultipleObjectField('Link')
class QuickAddForm(FlaskForm): id = HiddenField('', validators=[DataRequired()]) type = HiddenField('', validators=[DataRequired()]) submit = SubmitField('+ Quick Add')
class ImportExportForm(FlaskForm): boolean_fields = HiddenField(default='update_pools,replace') name = StringField() update_pools = BooleanField() replace = BooleanField()
class RemovalForm(FlaskForm): id = HiddenField('', validators=[DataRequired()]) type = HiddenField('', validators=[DataRequired()]) submit = SubmitField('X')
class ReportActionForm(FlaskForm): action = SelectField(choices=[('close', 'Close'), ('hide', 'Hide'), ('delete', 'Delete')]) torrent = HiddenField() report = HiddenField()