class PredictOpts(Form): type = SelectField('type', validators=[DataRequired()], choices=[('Max', 'Max'),('Average', 'Average'),('Min', 'Min')]) start = DateField('start_date',validators=[DateRange(min=date(2007,1,1),max=date(2007,12,31),format="%Y/%m/%d")]) end = DateField('end_date',validators=[DateRange(min=date(2007,1,1),max=date(2007,12,31),format="%Y/%m/%d")]) season = BooleanField('season', default=False) holiday = BooleanField('holiday', default=False) history = BooleanField('history', default=True)
class EventForm(FlaskForm): title = StringField('Title', validators=[DataRequired()]) description = TextAreaField('Description', validators=[Length(min=1, max=240)]) hyperlink = StringField('Link', validators=[Length(min=1, max=240), Optional()]) start_date = DateField('Start Date', format="%Y-%m-%d", default=datetime.today, validators=[DataRequired()]) start_time = TimeField('Start Time', format="%H:%M", default=datetime.now, validators=[Optional()]) end_date = DateField('End Date', format="%Y-%m-%d", validators=[Optional()]) end_time = TimeField('End Time', format="%H:%M", validators=[Optional()]) address = StringField('Address', validators=[Optional()]) zipcode = IntegerField('Zipcode', validators=[DataRequired(), validate_zipcode]) category = SelectField('Category', choices=[('general', 'General'), ('sport', 'Sports'), ('family', 'Family'), ('social', 'Social'), ('cultural', 'Cultural')], default='general') submit = SubmitField('Register')
class GeneralForm(FlaskForm): add_dep = StringField('Adresse de départ :', validators=[DataRequired()]) dep_home = BooleanField('Partir de votre domicile') add_arr = StringField('Adresse d\'arrivée :', validators=[DataRequired()]) """ tags = SelectMultipleField('Tags', choices=Tags(TAGS))""" locomotion = RadioField('Locomotion :', choices=[('driving', 'Voiture'), ('transit', 'Transports en commun'), ('walking', 'A pied')]) optimisation = RadioField('Optimisation :', choices=[('distance', 'Distance'), ('time', 'Temps'), ('affinity', 'Affinités')]) h_dep = TimeField('Heure de départ :') j_dep = DateField('Jour de départ :') h_arr = TimeField('Heure d\'arrivée :') j_arr = DateField('Jour d\'arrivée :') max_escales = SelectField('Nombre d\'escales souhaité :', choices=[(0, 0), (1, 1), (2, 2), (3, 3), (4, 4), (5, 5)]) escales = TextField('Escales :') t_max = RadioField('Durée maximale sans pause :', choices=[(0, 'Sans pause'), (3600, '1h00'), (7200, '2h00'), (10800, '3h00')]) d_max = RadioField('Distance maximale sans pause:', choices=[(0, 'Sans pause'), (100000, '100km'), (20000, '200km'), (300000, '300km')]) submit = SubmitField('Valider') ###############################################################################
class SearchForm(Form): date_start = DateField( 'Start', default=date.today() + relativedelta(years=-1), format='%d.%m.%Y', validators=[DateRange(min=date(2015, 1, 1), max=date(2016, 12, 31))]) date_end = DateField( 'End', default=date.today(), format='%d.%m.%Y', validators=[DateRange(min=date(2015, 1, 1), max=date(2016, 12, 31))])
class ViestinHakuLomake(FlaskForm): aihe = StringField("Aihe") nimi = StringField("Kirjoittaja") ryhma = StringField("Ryhmältä") alkupvm = DateField( "Alkaen", [DateRange(min=date(2000, 1, 1), max=date(3000, 1, 1))]) loppupvm = DateField( "Asti", [DateRange(min=date(2000, 1, 1), max=date(3000, 1, 1))]) nappi = SubmitField("Hae") class Meta: csrf = False
class SearchForm(FlaskForm): week_ago = datetime.today() - timedelta(days=7) start_date = DateField(label="Start Date", default=week_ago, validators=[Required]) end_date = DateField(label="End Date", default=datetime.today, validators=[Required]) user_name = StringField("User Name/Email Address") last_name = StringField("Last Name") org = SelectField("Organization", coerce=int) submit = SubmitField('Submit') csrf_token = HiddenField(default=os.environ.get("SECRET_KEY"))
class AddStudyGroupSessionForm(Form): """Form to create a StudyGroupSession(s) for a StudyGroup. Provides the option to automatically generate StudyGroupSessions until a given date """ date = DateField('Date', validators=[DataRequired()], format='%d %B, %Y') time = TimeField('Time', validators=[DataRequired()]) repeat = BooleanField('Repeat', validators=[Optional()]) repeat_frequency = SelectField('Repeat Every', validators=[Optional()], choices=[(str(i), str(i) + ' days') for i in range(1, 15)]) repeat_until = DateField('Repeat Until', validators=[Optional()], format='%d %B, %Y')
class AbsenceForm(FlaskForm): name = StringField("Absence name", [ validators.DataRequired(message="Absence name can't be empty"), validators.Length(min=2, max=140) ]) description = StringField("Absence description", [validators.Length(max=996)]) date_start = DateField( 'Start date YYYY-MM-DD', [validators.DataRequired(message="Start date can't be empty")]) date_end = DateField( 'End date YYYY-MM-DD', [validators.DataRequired(message="Start date can't be empty")]) class Meta: csrf = False
class DashbinfoForm(FlaskForm): # Setting username requirements for registration form try: dbtitle = StringField( 'Title', validators=[InputRequired(), uniquedashb, Length(min=3, max=200)]) dbcatg = StringField( 'Category', validators=[InputRequired(), Length(min=3, max=200)]) ddate = DateField( 'Publication Date', validators=[InputRequired(), DateRange(format='%m/%d/%Y')]) author = StringField( 'Author(s)', validators=[InputRequired(), Length(min=3, max=50)]) enduser = StringField( 'Enduser (Username/Email)', validators=[InputRequired(), enduservalid, Length(min=3, max=100)] ) # later add dropdown for endusers. # add more email addresses to notify externurl = BooleanField('External Url?') submit = SubmitField('Request your Dashboard Page') # add description variable for dashbinfo later except Exception as e: logging.error(str("Error: " + str(e)))
class TransportForm(FlaskForm): organizer = StringField('Organizer', validators=[DataRequired()]) needs_organization = BooleanField('Needs organization') origin = TextAreaField('Origin', validators=[DataRequired()]) destination = TextAreaField('Destination', validators=[DataRequired()]) date = DateField('Date', validators=[ DataRequired(), DateRange(min=max( datetime.date.today(), datetime.date(year=2019, month=8, day=1)), max=datetime.date(year=2019, month=9, day=5)) ]) time = TimeField('ETA', validators=[Optional()]) vehicle = SelectField('Vehicle', validators=[DataRequired()], choices=[('', '')] + list(VehicleTypes.items())) goods = TextAreaField('Goods', validators=[DataRequired()]) vehicle_owner = StringField('Vehicle Owner') orga_contact = TextAreaField('Orga Contact Person / Details', validators=[DataRequired()]) driver_contact = TextAreaField('Driver Contact Person / Details') comment = TextAreaField('Comment') file_upload = FileField('Files', render_kw={'multiple': True}) save = SubmitField('Save') saveasnew = SubmitField('Save as new')
class TransportForm(FlaskForm): organizer = StringField("Organizer", validators=[DataRequired()]) needs_organization = BooleanField("Needs organization") origin = TextAreaField("Origin", validators=[DataRequired()]) destination = TextAreaField("Destination", validators=[DataRequired()]) date = DateField( "Date", validators=[ DataRequired(), DateRange( min=datetime.date(year=2019, month=12, day=14), max=datetime.date(year=2020, month=1, day=7), ), ], ) time = TimeField("ETA", validators=[Optional()]) vehicle = SelectField( "Vehicle", validators=[DataRequired()], choices=[("", "")] + list(VehicleTypes.items()), ) goods = TextAreaField("Goods", validators=[DataRequired()]) vehicle_owner = StringField("Vehicle Owner") orga_contact = TextAreaField("Orga Contact Person / Details", validators=[DataRequired()]) driver_contact = TextAreaField("Driver Contact Person / Details") comment = TextAreaField("Comment") file_upload = FileField("Files", render_kw={"multiple": True}) save = SubmitField("Save") saveasnew = SubmitField("Save as new")
class TrackGoalForm(FlaskForm): name = TextAreaField(_l(u'Goal Name'), validators=[DataRequired()]) #describe what your accomplishment will look like smart_description = TextAreaField(_l('Description')) #Enter the date when you plan to achieve your goal. Suggestion: It is more satisfying to achieve smaller goals in short periods of time, such as one to six months from today. #add logic: if date > then six months from today, give user pop-up message suggesting a shorter time frame. due_date = DateField(_l('Due Date', format='%Y-%m-%d')) #Does your goal fit into a particular dimension of your well-being? If so, select it below. dimension = SelectField(_l('Well-being Dimension'), choices=[('Environmental', 'Environmental'), ('Intellectual', 'Intellectual'), ('Financial', 'Financial'), ('Mental-Emotional', 'Mental-Emotional'), ('Occupational', 'Occupational'), ('Physical', 'Physical'), ('Social', 'Social'), ('Spiritual', 'Spiritual'), ], coerce=str, option_widget=None, validators=[DataRequired()]) #how will you know that you have accomplished the goal? #enter the number of units that will demonstrate you have successfully accomplished the goal #For example, if your goal is to lose weight, enter the number of pounds or kilos that you plan to lose. #If you want to achieve a specific GPA, enter the GPA number. #If you plan to complete an single event (run a 10k foot race or a marathon) or earn a single techincal certification, enter 1. unit_number = IntField(_l('Measurement Number'), validators=[Length(min=0, max=10)] #enter the type of measurement unit_type = SelectField(_l(u'Unit of Measurement'), choices=[('number', 'number'), ('lbs', 'lbs'), ('kg', 'kg'), ('hours', 'hours'), ('minutes', 'minutes'), ('GPA', 'GPA')], coerce=str, option_widget=None, validators=[DataRequired()]) done = SelectField(u'Complete?', choices=[('no', 'No'), ('yes', 'Yes'),]) submit = SubmitField(_l('Submit'))
def convert_DateProperty(self, model, prop, kwargs): """Returns a form field for a ``ndb.DateProperty``.""" if prop._auto_now or prop._auto_now_add: return None self._prop_required_datetime(kwargs, prop) return DateField(format='%Y-%m-%d', **kwargs)
class LteForm(FlaskForm): input = IntegerField('Input Count', validators=[InputRequired()]) archive = IntegerField('Archive Count', validators=[InputRequired()]) error = IntegerField('Error Count', validators=[InputRequired()]) drop = IntegerField('Drop Count', validators=[InputRequired()]) location = SelectField('Location', choices=[('lsdc', 'LSDC'),('reston','Reston'),('other','Other')]) rdate = DateField('Date',default=date.today(), format="%Y-%m-%d") delete = HiddenField('Delete', default='N', validators=[Length(max=1)])
class TaskForm(FlaskForm): name = StringField('Name', [InputRequired()]) description = TextAreaField('Description', [Optional(), Length(max=1000)]) date = DateField('Date', [Optional()], default=datetime.today()) time = TimeField('Time', [Optional()]) category = SelectField('Category', [Optional()], choices=sorted( (x, x.capitalize()) for x in Task.categories))
class FlightForm(FlaskForm): name = StringField('name', validators=[InputRequired()]) location = StringField('location', validators=[InputRequired()]) date = DateField('date', format='%Y-%m-%d', validators=[InputRequired()]) duration_hours = IntegerField('duration_hours', validators=[ InputRequired(), NumberRange( min=0, max=23, message="Give a number from 0-23") ]) duration_mins = IntegerField('duration_mins', validators=[ InputRequired(), NumberRange( min=0, max=59, message="Give a number from 0-59") ]) duration_secs = IntegerField('duration_secs', validators=[ InputRequired(), NumberRange( min=0, max=59, message="Give a number from 0-59") ]) flight_types = [('Commercial', 'Commercial'), ('Emergency', 'Emergency'), ('Hobby', 'Hobby'), ('Maintenance', 'Maintenance'), ('Science', 'Science'), ('Simulator', 'Simulator'), ('Test Flight', 'Test Flight'), ('Training Flight', 'Training Flight')] flight_type = SelectField('flight_type', choices=flight_types, validators=[InputRequired()]) more_type_info = StringField('more_type_info', validators=[Optional()]) operation_types = [('VLOS', 'VLOS'), ('EVLOS', 'EVLOS'), ('BVLOS/BLOS', 'BVLOS/BLOS'), ('Autonomous', 'Autonomous'), ('FPV', 'FPV')] operation_type = SelectField('operation_type', choices=operation_types, validators=[InputRequired()]) project = SelectField('project', coerce=int, validators=[InputRequired()]) drone = SelectField('drone', coerce=int, validators=[InputRequired()]) night_flight = BooleanField('night_flight', validators=[Optional()]) landing_count = IntegerField('landing_count', validators=[InputRequired()]) travelled_distance = DecimalField('travelled_distance', validators=[InputRequired()]) max_agl_altitude = DecimalField('max_agl_altitude', validators=[InputRequired()]) notes = TextAreaField('notes', validators=[Optional()]) weather_description = TextAreaField('weather_description', validators=[Optional()])
class LeaderboardForm(Form): date = DateField('Date', format='%Y-%m-%d', validators=[validators.DataRequired()]) number_delegates = IntegerField( 'Number', validators=[validators.NumberRange(min=1, max=1000)]) format = RadioField('format', choices=[('graph', 'Graph'), ('table', 'Table')], default='graph')
class ProjectBasicForm(Form): """プロジェクト: 基本情報""" title = StringField('タイトル', validators=[DataRequired('タイトルを入力してください')]) summary = TextAreaField('概要', validators=[DataRequired('概要を入力してください')]) type = SelectField('タイプ', validators=[DataRequired()], coerce=int, choices=[ (1, '実施確約型'), (2, 'チャレンジ型'), (3, 'プレオーダー型'), ]) target_amount = IntegerField( '目標金額', default=1000000, validators=[ DataRequired('目標金額を入力してください'), NumberRange(min=1, max=999999999, message='目標金額は1〜999,999,999円で設定してください') ]) open_amount = BooleanField('表示する', validators=[], default=True) start_date = DateField('開始日', validators=[], default=(datetime.today() + timedelta(days=7)).date()) start_time = TimeField('開始時刻', validators=[], default=time(22, 0, 0, 0)) end_date = DateField('終了日', validators=[], default=(datetime.today() + timedelta(days=87)).date()) end_time = TimeField('終了時刻', validators=[], default=time(22, 0, 0, 0)) main_color = SelectField('メインカラー', validators=[], coerce=str, choices=[ ('white', '白'), ('black', '黒'), ]) accent_color = ColorField('アクセントカラー', validators=[], default=Color('#c5ac69')) image = FileField('画像', validators=[]) submit = SubmitField('保存')
class EditEventForm(FlaskForm): """ Input forms used on the edit event page. """ title = StringField('Title', validators=[DataRequired()]) description = TextAreaField('Description', validators=[DataRequired()]) date = DateField('Date', validators=[DataRequired(), DateRange(min=date.today())]) startTime = TimeField('Start Time', validators=[DataRequired()]) endTime = TimeField('End Time', validators=[DataRequired()]) submit = SubmitField('Edit Event')
class CompetitionForm(FlaskForm): name = StringField( 'Competition Name', validators=[DataRequired("Please enter a name for your competition")]) address = StringField('Address') city = StringField('City') state = StringField('State') zipcode = StringField('Zipcode') date = DateField('Date', format="%Y-%m-%d") submit = SubmitField('Create competition')
class PersonBaseForm(Form): pid = HiddenField("") vorname = TextField("Vorname", [validators.Required()]) name = TextField("Nachname", [validators.Required()]) title = TextField("Titel") birthday = DateField( "Geburtstag (tt.mm.jjjj)", [validators.Required()], format=my_date_format, )
class RSVPFormWithAccommodation(RSVPForm): accommodation_check_in = DateField( _("Check-In Date"), format="%Y-%m-%d", validators=[ validators.DataRequired( message=_("You must provide a check-in date")), DateRange(min=Config.BOOKING_MIN_DATE, max=Config.WEDDING_DATETIME.date()), ], ) accommodation_check_out = DateField( _("Check-Out Date"), format="%Y-%m-%d", validators=[ validators.DataRequired( message=_("You must provide a check-out date")), DateRange(min=Config.WEDDING_DATETIME.date() + timedelta(days=1), max=Config.BOOKING_MAX_DATE), ], ) accommodation_price_accepted = BooleanField( _("I accept the price per night of "), default=True) @property def check_out_date(self) -> date: return self.accommodation_check_out.data @property def check_in_date(self) -> date: return self.accommodation_check_in.data def validate(self, extra_validators=None): success = super().validate(extra_validators) if self.check_out_date <= self.check_in_date: self.accommodation_check_out.errors.append( _("Please ensure the check-out date is after the check-in date" )) success = False return success
class CategoryFoodForm(FlaskForm): category = SelectField('Select a category: ', choices=[('1', 'Category1'), ('2', 'Category2')]) food_item = SelectField('Select a food item: ', choices=[('1', 'foodItem1'), ('2', 'foodItem2'), ('3', 'foodItem3'), ('4', 'foodItem4'), ('5', 'foodItem5'), ('6', 'foodItem6')]) quantity = StringField("Quantity: ") weight = StringField("Weight: ") nutrition = StringField("Nutrition: ") expiration_date = DateField('Expiration Date: ')
class NewTournament(FlaskForm): name = StringField('Name', validators=[ DataRequired('A tournament name is requiered')]) password = PasswordField('Pasword', validators=[Optional()]) players_admited = SelectField('Number of players', validators=[ Optional()], choices=[('2', 2), ('4', 4), ('8', 8), ('16', 16)], default=2) discord_server_id = IntegerField( 'Discord Server ID', validators=[Optional()]) elo_limit_low = IntegerField('Lowest ELO Limit', validators=[DataRequired( 'ELO limit is requiered'), NumberRange(min=1, max=3000)]) elo_limit_high = IntegerField('Highest ELO Limit', validators=[DataRequired( 'ELO limit is requiered'), NumberRange(min=1, max=3000)]) start_date = DateField('Start Date', format='%Y-%m-%d', validators=[DataRequired( 'Start date is requiered'), validators.DateRange(min=date.today())]) start_time = TimeField('Start Time', format='%H:%M', validators=[ DataRequired('Start time is requiered')]) end_date = DateField('End Date', format='%Y-%m-%d', validators=[DataRequired( 'End date is requiered'), validators.DateRange(min=date.today())]) end_time = TimeField('End Time', format='%H:%M', validators=[ DataRequired('End time is requiered')])
class TodoForm(FlaskForm): title = StringField('Title', validators=[DataRequired()]) description = TextAreaField('Description', validators=[DataRequired()]) due_date = DateField('Due date') priority = SelectField('Priority', choices={(0, 'low'), (1, 'mid'), (2, 'high')}, coerce=int, default=1) comment = TextAreaField('Comment') ''' Zukunftsmusik ..
class AdvancedSearchForm(FlaskForm): zipcode = IntegerField('Zipcode', validators=[DataRequired(), validate_zipcode]) distance = SelectField('Distance', choices=[('100', '100'), ('30', '30'), ('10', '10')], default='30') start_date = DateField('Start Date', format="%Y-%m-%d", default=datetime.today, validators=[DataRequired()]) end_date = DateField('End Date', format="%Y-%m-%d", validators=[Optional()]) category = MultiCheckboxField('Category', choices=[('general', 'General'), ('sport', 'Sports'), ('family', 'Family'), ('social', 'Social'), ('cultural', 'Cultural')], validators=[Optional()]) submit = SubmitField('Search')
class TaskForm(FlaskForm): name = TextAreaField(_l(u'Task Name'), validators=[DataRequired()]) priority = SelectField(_l('Priority'), choices=[('high', 'high'), ('medium', 'medium'), ('low', 'low')], validators=[DataRequired()]) due_date = DateField(_l('Due Date', format='%Y-%m-%d')) description = TextAreaField(_l('Description')) done = SelectField(u'Complete?', choices=[ ('no', 'No'), ('yes', 'Yes'), ]) submit = SubmitField(_l('Submit'))
class TaskForm(FlaskForm): text = StringField('Task', validators=[DataRequired()]) do_by_date = DateField('Do By Date') do_by_time_h = IntegerField('Hour') do_by_time_m = IntegerField('Minute') priority = SelectField('Priority', choices=[ ('Priority', 'Priority'), ('Low', 'Low'), ('Medium', 'Medium'), ('High', 'High') ]) submit = SubmitField('Add Task')
class ManageDonateForm(FlaskForm): header_id = HiddenField() beneficiary = TextField("Perferred beneficiary (Optional): ") appointment_date = DateField('Appointment Date: ') appointment_time = TimeField('Appointment Time: ') frequency = SelectField('Frequency: ', choices=[('1', 'One Time'), ('2', 'Weekly'), ('3', 'Monthly')]) notes = TextAreaField("Do you have anything specific for this donation?") food_items = FieldList(FormField(CategoryFoodForm), min_entries=1) # subform for Category-Food def __init__(self): super(ManageDonateForm, self).__init__()
class DonateForm(FlaskForm): donate_to = SelectField('Donate to: ', coerce=int) beneficiary = TextField("Perferred beneficiary (Optional): ") appointment_date = DateField('Appointment Date: ') appointment_time = TimeField('Appointment Time: ') frequency = SelectField('Frequency: ', choices=[('1', 'One Time'), ('2', 'Weekly'), ('3', 'Monthly')]) notes = TextAreaField("Do you have anything specific for this donation?") food_items = FieldList(FormField(CategoryFoodForm), min_entries=1) # subform for Category-Food plus_button = SubmitField("+") minus_button = SubmitField("-") def __init__(self, foodbank_choices): super(DonateForm, self).__init__() self.donate_to.choices = foodbank_choices