class BaseForm(Form): # Personal data species = RadioButtonField('Species', validators=[InputRequired()], choices=[('man', u'Vīrietis'), ('woman', u'Sieviete')], default='') name = TextField('Name', validators=[InputRequired(), Length(max=255)]) surname = TextField('Surname', validators=[InputRequired(), Length(max=255)]) nickname = TextField('Nickname', validators=[Length(max=255)]) pcode = TextField('ID code', validators=[Length(max=255)]) contract_nr = TextField('Passport nr.', validators=[Length(max=255)]) birthdate = DateField('Birthdate') play_age_from = TextField('Play age from', validators=[Length(max=2)]) play_age_to = TextField('Play age to', validators=[Length(max=2)]) # Family mother_phone_code = TextField('Mother phone code', validators=[Length(max=255)]) mother_phone = TextField('Mother phone', validators=[Length(max=255)]) mother_name = TextField('Mother name', validators=[Length(max=255)]) father_phone_code = TextField('Father phone code', validators=[Length(max=255)]) father_phone = TextField('Father phone', validators=[Length(max=255)]) father_name = TextField('Father name', validators=[Length(max=255)]) #Contact information my_phone_code = TelField('Phone code', validators=[Length(max=255)]) my_phone = TelField('Phone', validators=[InputRequired(), Length(max=255)]) email = TextField('E-mail', validators=[InputRequired(), Length(max=255)]) other_phone_code = TextField('Other phone code', validators=[Length(max=255)]) other_phone = TextField('Other phone', validators=[Length(max=255)]) home_address = TextField('Home address', validators=[InputRequired(), Length(max=255)]) city = SelectField('Nearest city', choices=[]) #Personal carecteristics height = TextField('Height', validators=[Length(max=3)]) foot_size = SelectFieldNoValidate('Foot size', choices=[]) cloth_size = SelectFieldNoValidate('Cloth size', choices=[]) voice = SelectFieldNoValidate('Voice', choices=[]) haircolor = SelectField('Hair color', choices=[]) eyecolor = SelectField('Eye color', choices=[]) #Who you are? speciality = RadioButtonField('Speciality', validators=[InputRequired()], choices=[('actor', u'Aktieris'), ('professional', u'Profesionālis'), ('talent', u'Talants')]) subspeciality = SelectMultipleFieldNoValidate('Subspeciality', choices=[]) experience = TextAreaField('Experience', validators=[Length(max=1000)]) cv = FileField('CV') #actor = TextField('Actor') #professional = TextField('Professional') #talent = TextField('Talent') #Skills #danceskill = TextField('Dance skill') danceskill = SelectMultipleFieldNoValidate('Dance skill', choices=[]) singskill = SelectMultipleFieldNoValidate('Sing skill', choices=[]) musicskill = SelectMultipleFieldNoValidate('Music skill', choices=[]) sportskill = SelectMultipleFieldNoValidate('Sport skill', choices=[]) swimskill = SelectMultipleFieldNoValidate('Swim skill', choices=[]) driveskill = SelectMultipleFieldNoValidate('Drive skill', choices=[]) languageskill = SelectMultipleFieldNoValidate('Language skill', choices=[]) otherskill = SelectMultipleFieldNoValidate('Other skill', choices=[]) #Work and Education educational_institution = SelectMultipleFieldNoValidate( 'Educational institution', choices=[]) learned_profession = SelectMultipleFieldNoValidate('Learned profession', choices=[]) degree = SelectMultipleFieldNoValidate('Level of education', choices=[]) current_occupation = SelectFieldNoValidate('Current occupation', choices=[]) workplace = TextField('Workplace', validators=[Length(max=255)]) #My whishes want_participate = SelectMultipleFieldNoValidate('Want to participate', choices=[]) dont_want_participate = SelectMultipleFieldNoValidate( 'Don`t want to participate', choices=[]) interested_in = SelectMultipleFieldNoValidate('Interested in', choices=[]) #Notes for consideration #contact_lenses = TextField('Contact Lenses') contact_lenses = BooleanField('Contact Lenses') be_dressed = BooleanField('Don`t want to be undressed') tattoo = SelectMultipleFieldNoValidate('Tattoos', choices=[]) piercing = SelectMultipleFieldNoValidate('Piercings', choices=[]) afraidof = SelectMultipleFieldNoValidate('I`am afraid of', choices=[]) religion = SelectMultipleFieldNoValidate('Religion beliefs', choices=[]) image1 = FileField('Image No.1') image2 = FileField('Image No.2') profile_image = FileField('Profile image') cb_tags = SelectMultipleFieldNoValidate('Casting bridge tags', choices=[]) family_notes = SelectMultipleFieldNoValidate('Family notes', choices=[]) video = FileField('Video') audio = FileField('Audio')
class SearchForm(Form): term = TextField('', [InputRequired()]) ignore_case = BooleanField( description='Ignore Case', # FIXME: default is not correctly populated default=True)
class CreateUserForm(Form): name = TextField('', [InputRequired()]) password = PasswordField('', [InputRequired()])
class Login(FlaskForm): name = StringField('Name', validators=[InputRequired(), Length(min=4, max=50)]) password = PasswordField('Password', validators={InputRequired(), Length(min=4, max=40)})
class TenantForm(BaseForm): name = StringField(l_('Name'), validators=[InputRequired()]) slug = StringField(l_('Identifier')) members = FormField(MembersForm) submit = SubmitField()
class BanForm(Form): banreason = TextAreaField('Ban reason', [InputRequired()]) submit = SubmitField('Ban')
class PlaylistForm(FlaskForm): """Form for adding playlists.""" name = StringField( "Playlist Name", validators=[InputRequired(message="Playlist Name cannot be blank")]) description = StringField("Description")
class PasswordForm(FlaskForm): password = PasswordField('New Password', validators=[InputRequired(), Length(min=3)]) submit = SubmitField('Change Password')
class AuthenticationPasswordForm(FlaskForm): id = IntegerField('Authentication_method_id', validators=[DataRequired()]) password = PasswordField('New Password', validators=[InputRequired(), Length(min=3)]) submit = SubmitField('Change Password')
class InvitationForm(FlaskForm): email = StringField(validators=[InputRequired()])
class RequestPasswordResetForm(FlaskForm): email = StringField(validators=[InputRequired()])
class SigninForm(FlaskForm): username = StringField(validators=[InputRequired()]) password = PasswordField(validators=[InputRequired()]) remember_me = BooleanField()
class secti(Form): hodnota1 = IntegerField("vlozHodnotu1", validators=[InputRequired(message="vyzadovano")]) hodnota2 = IntegerField("vlozHodnotu2", validators=[InputRequired(message="vyzadovano")])
class LoginForm(Form): """Form for the user""" username = StringField('Username', [InputRequired()]) password = PasswordField('Password', [InputRequired()])
class RecoverPasswordForm(Form): email = StringField('Email', [InputRequired(), Email(), Length(max=63)]) submit = SubmitField('Recover Password')
class BookingForm(FlaskForm): name = StringField('Имя пользователя', [InputRequired()]) phone = StringField('Телефон пользователя', [InputRequired()])
class RejectForm(Form): rejectreason = TextAreaField('Reject reason', [InputRequired()]) submit = SubmitField('Reject')
class CustomTelescopeForm(FlaskForm): '''Handles custom telescope input page and optional observability inputs''' # magnitude zero points # for filter_ in Telescope.filter_list: # if 'mag_' + filter_ in Star.property_dict: # setattr(self, 'mag_' + filter_, # FloatField( validators = [Optional()], render_kw = {"placeholder": "mzp %s" %filter_, "title": "Zero-point magnitude in the %s band" %filter_})) mzp_V = FloatField(validators=[Optional()], render_kw={ "placeholder": "mzp V", "title": "Zero-point magnitude in the V band" }) mzp_I = FloatField(validators=[Optional()], render_kw={ "placeholder": "mzp I", "title": "Zero-point magnitude in the I band" }) mzp_J = FloatField(validators=[Optional()], render_kw={ "placeholder": "mzp J", "title": "Zero-point magnitude in the J band" }) mzp_H = FloatField(validators=[Optional()], render_kw={ "placeholder": "mzp H", "title": "Zero-point magnitude in the H band" }) mzp_K = FloatField(validators=[Optional()], render_kw={ "placeholder": "mzp K", "title": "Zero-point magnitude in the K band" }) # other telescope parameters spectral_bins = IntegerField( validators=[DataRequired(), NumberRange(min=1)], render_kw={ "placeholder": "No. spectral bins", "title": "No. spectral bins: 1 for photometric, >1 for spectroscopic (must be integer)" }) t_over = FloatField( validators=[InputRequired(), NumberRange(min=0)], render_kw={ "placeholder": "Overhead time (s)", "title": "Time in seconds between exposures (can be 0 for our calculations)" }) Half_Well = IntegerField( validators=[DataRequired(), NumberRange(min=0)], render_kw={ "placeholder": "Half-well electron count", "title": "Number of photoelectrons to saturate each pixel to 50% (must be integer)" }) texp_min = FloatField( validators=[Optional(), NumberRange(min=0)], render_kw={ "placeholder": "Minimum exposure time (s) (optional)", "title": "Minimum exposure time in seconds (needed for some telescopes)" }) Theta_see = FloatField( validators=[DataRequired(), NumberRange(min=0)], render_kw={ "placeholder": "Seeing size (arcsec)", "title": "(Average) seeing size at the telescope site in arcseconds, as a FWHM of a Gaussian\n(may of course be different on the night)" }) Theta_DF = FloatField( validators=[Optional(), NumberRange(min=0)], render_kw={ "placeholder": "Defocused aperture size (arcsec) (optional)", "title": "Aperture size used for defocused operations in arcseconds" }) Omega_pix = FloatField(validators=[DataRequired(), NumberRange(min=0)], render_kw={ "placeholder": "Pixel size (square arcsec)", "title": "Pixel area in square arcseconds" }) # telescope location longitude = FloatField( validators=[Optional()], render_kw={ "placeholder": "Longitude (deg)", "title": "Longitude at telescope location in degrees (optional)" }) latitude = FloatField( validators=[Optional()], render_kw={ "placeholder": "Latitude (deg)", "title": "Latitude at telescope location in degrees (optional)" }) elevation = FloatField(validators=[Optional()], render_kw={ "placeholder": "Elevation (m)", "title": "Telescope elevation in metres (default 0)" }) # further observability parameters min_altitude = FloatField( validators=[Optional()], render_kw={ "placeholder": "Minimum altitude (deg)", "title": "Minimum altitude telescope can observe (deg) (default 0)" }) max_altitude = FloatField( validators=[Optional()], render_kw={ "placeholder": "Maximum altitude (deg)", "title": "Maximum altitude telescope can observe (deg) (default 90)" }) start_date = DateField( validators=[Optional()], render_kw={ "placeholder": "Start date (yyyy-mm-dd)", "title": "Starting date to check for observability (default today)" }) end_date = DateField( validators=[Optional()], render_kw={ "placeholder": "End date (yyyy-mm-dd)", "title": "Ending date to check for observability (default 30 days from start date)" }) resolution = FloatField( validators=[Optional()], render_kw={ "placeholder": "Timing resolution (hr)", "title": "Timing resolution in hours for checking observability (will significantly affect calculation time) (default 0.5)" }) # radio button and sumbit button submit = SubmitField() def validate(self): '''custom verification on top of standard checks already applied''' if not super(CustomTelescopeForm, self).validate(): return False fine = True # check at least one mzp given if not (self.mzp_V.data or self.mzp_I.data or self.mzp_J.data or self.mzp_H.data or self.mzp_K.data): msg = 'At least one mzp must be set' self.mzp_V.errors.append(msg) self.mzp_I.errors.append(msg) self.mzp_J.errors.append(msg) self.mzp_H.errors.append(msg) self.mzp_K.errors.append(msg) fine = False # check spectral_bins and Half_Well are integers if not (isinstance(self.spectral_bins.data, int) and isinstance(self.Half_Well.data, int)): msg = 'Must be a positive integer' self.spectral_bins.errors.append(msg) self.Half_Well.errors.append(msg) fine = False # check if any location parameters given, then both latitude and longitude are given, and check limits if self.longitude.data or self.latitude.data or self.elevation.data or self.min_altitude.data or self.max_altitude.data or self.start_date.data or self.end_date.data or self.resolution.data: msg = 'Both latitude and longitude needed to check observability (otherwise leave all location fields blank)' if self.longitude.data is None: self.longitude.errors.append(msg) fine = False elif not (-180 <= self.longitude.data <= 180): self.longitude.errors.append( 'Longitude must be between -180 and 180 degrees') fine = False if self.latitude.data is None: self.latitude.errors.append(msg) fine = False elif not (-90 <= self.latitude.data <= 90): self.latitude.errors.append( 'Latitude must be between -90 and 90 degrees') fine = False # check end_date > start_date if self.end_date.data is not None: msg = 'End date must be after start date' if self.start_date.data is not None: if self.end_date.data <= self.start_date.data: self.end_date.errors.append(msg) fine = False else: if self.end_date.data <= date.today(): self.end_date.errors.append(msg) fine = False # check max > min altitude if self.min_altitude.data is not None and self.max_altitude.data is not None: if self.min_altitude.data >= self.max_altitude.data: msg = 'Maximum altitude must be greater than minimum' self.max_altitude.errors.append(msg) fine = False # if all fine, return True, else return false return fine
class MailForm(Form): subject = StringField('Subject', [InputRequired()]) content = TextAreaField('Content', [InputRequired()]) submit = SubmitField('Send')
class LoginForm(FlaskForm): username = StringField("Username", validators = [InputRequired()]) password = StringField("Password", validators = [InputRequired()])
class RegisterForm(FlaskForm): name = StringField('Name', validators=[InputRequired(), Length(min=4, max=50)]) phone_no = IntegerField('Phone Number', validators=[InputRequired()]) email = StringField('Email', validators=[InputRequired(), Email(message='Invalid email'), Length(min=5, max=80)]) password = PasswordField('Password', validators=[InputRequired(), Length(min=8, max=40)]) confirm = PasswordField('Confirm Password', validators=[InputRequired(), Length(min=8, max=40)])
class FeedbackForm(FlaskForm): title = StringField("Title", validators=[InputRequired(), Length(max=50)]) content = StringField("Content", validators=[InputRequired(), Length(max=250)])
class GroupForm(BaseForm): name = StringField(l_('Name'), validators=[InputRequired()]) members = FormField(MembersForm) tenant_uuid = SelectField(l_('Tenant'), choices=[]) tenant = FormField(TenantUuidForm) submit = SubmitField()
class UserForm(FlaskForm): username = StringField("Username", validators = [InputRequired()]) password = StringField("Password", validators = [InputRequired()]) email = StringField("Email", validators = [InputRequired()]) first_name = StringField("First Name", validators = [InputRequired()]) last_name = StringField("Last Name", validators = [InputRequired()])
class AccessForm(BaseForm): value = StringField(validators=[InputRequired()])
class loginForm(FlaskForm): username = StringField('Usuario', validators=[InputRequired(), Length(min=4, max= 15)]) password = PasswordField('Contraseña', validators=[InputRequired(), Length(min=6, max(20))]) remember = BooleanField('Recuerda me')
class EditorForm(Form): title = TextField('', [InputRequired()]) body = TextAreaField('', [InputRequired()]) tags = TextField('')
class LoginForm(Form): email = StringField('Email', [InputRequired(), Email(), Length(max=63)]) password = PasswordField('Password', [InputRequired()]) submit = SubmitField('Login')
class NewItem(FlaskForm): name = StringField('Name', validators=[Length(0, 80), InputRequired()]) description = StringField('Description', validators=[Length(0, 250), InputRequired()]) category = QuerySelectField(get_label='name', query_factory=categoryQuery) submit = SubmitField('Submit')
class LoginForm(FlaskForm): username = StringField("Username", validators=[InputRequired(), Length(4, 100)]) password = PasswordField("Password", validators=[InputRequired(), Length(min=8, max=100)]) remember = BooleanField('Remember me') submit = SubmitField("Submit")