class CampaignForm(FlaskForm): id = IntegerField(render_kw={'readonly': True}) title = TextAreaField(validators=[DataRequired()]) active = BooleanField(default=True) start_date = DateField(format="%Y-%m-%d", validators=[DataRequired()], default=lambda: dt.datetime.now().date()) start_time = TimeField(format="%H:%M", validators=[DataRequired()], default=lambda: dt.datetime.now().time()) end_date = DateField(format="%Y-%m-%d", validators=[DataRequired()], default=lambda: dt.datetime.now().date()) end_time = TimeField(format="%H:%M", validators=[DataRequired()], default=lambda: dt.datetime.now().time()) interval = IntegerField(validators=[DataRequired()], default=3600) measure_walli = BooleanField(default=True) measure_light = BooleanField(default=True) def populate(self, cpn): self.id.data = cpn.id self.title.data = cpn.title self.active.data = cpn.is_active self.start_date.data = cpn.start.date() self.start_time.data = cpn.start.time() self.end_date.data = cpn.end.date() self.end_time.data = cpn.end.time() self.interval.data = int(cpn.interval / dt.timedelta(seconds=1)) self.measure_walli.data = cpn.measure_walli self.measure_light.data = cpn.measure_light
class CreatePlaylistForm(FlaskForm): queue = SelectField( "Queue", choices=[ ("default", "Default (Automatic Traffic)"), ("prerecorded", "Prerecorded (No Automatic Traffic)"), ], widget=BootstrapSelect(), ) date = DateField("Date", validators=[validators.InputRequired()], widget=BootstrapDateInput()) time_start = TimeField( "Start Time", validators=[validators.InputRequired()], widget=BootstrapTimeInput(), ) time_end = TimeField("End Time", validators=[validators.InputRequired()], widget=BootstrapTimeInput()) dj_id = SelectField("DJ", choices=[("1", "Automation")], widget=BootstrapSelect()) def validate_date(self, field): if not isinstance(field.data, datetime.date): raise ValidationError("A date must be provided.") if field.data < datetime.datetime.now(get_slot_tz()).date(): raise ValidationError("The date cannot be in the past.")
class AppointmentForm(FlaskForm): name = StringField("name", validators=[DataRequired()]) start_date = DateField("start_date", validators=[DataRequired()], widget=DateInput()) start_time = TimeField("start_time", validators=[DataRequired()], widget=TimeInput()) end_date = DateField("end_date", validators=[DataRequired()], widget=DateInput()) end_time = TimeField("end_time", validators=[DataRequired()], widget=TimeInput()) description = TextAreaField("description", validators=[DataRequired()]) private = BooleanField("private") submit = SubmitField("Submit") def validate_end_date(form, field): start = datetime.combine(form.start_date.data, form.start_time.data) end = datetime.combine(field.data, form.end_time.data) if start >= end: msg = "End date/time must come after start date/time" raise ValidationError(msg) if form.start_date.data != form.end_date.data: msg = "End date must be the same as start date" raise ValidationError(msg)
class EntryForm(FlaskForm): date = DateField(label="Datum", validators=[InputRequired()], format='%d.%m.%Y') start = TimeField(label="Beginn", validators=[InputRequired()]) end = TimeField(label="Ende", validators=[InputRequired()]) pause = IntegerField(label="Pause", validators=[InputRequired()]) comment = StringField(label="Kommentar")
class AppointmentForm(FlaskForm): name = StringField("Name", validators=[DataRequired()]) start_date = start_date = DateField( "Start date", [DataRequired()], widget=DateInput()) start_time = TimeField("Start Time", [DataRequired()], widget=TimeInput()) end_date = DateField("End Date", [DataRequired()], widget=DateInput()) end_time = TimeField("End Time", [DataRequired()], widget=TimeInput()) description = TextAreaField("Description", validators=[DataRequired()]) private = BooleanField("Private") submit = SubmitField("Save")
class ObservationItemForm(FlaskForm): comp_notes = TextAreaField( lazy_gettext('DSO list with comment. (e.g. M3,M5:nice globulars!)'), render_kw={'rows': 2}) date_from = TimeField(lazy_gettext('Time From'), format='%H:%M', default=datetime.now().time()) sqm = FloatField(lazy_gettext('Sqm'), validators=[Optional()]) seeing = SelectField(lazy_gettext('Seeing'), choices=Seeing.choices(), coerce=Seeing.coerce, default=Seeing.AVERAGE) transparency = SelectField(lazy_gettext('Transparency'), choices=Transparency.choices(), coerce=Transparency.coerce, default=Transparency.AVERAGE) def validate_comp_notes(form, field): if field.id != 'items-0-comp_notes': targets = field.data if ':' in targets: targets = targets[:targets.index(':')] if len(targets) == 0: raise ValidationError(lazy_gettext('Value expected.')) dsos, double_star, not_found = parse_observation_targets(targets) if not_found: msg = lazy_gettext('Unknown targets:') + ','.join(not_found) raise ValidationError( lazy_gettext('Unknown targets:') + ','.join(not_found))
class AppointmentForm(FlaskForm): name = StringField('name', validators=[DataRequired()]) start_date = DateField('start_datetime', widget=DateInput(), validators=[DataRequired()]) start_time = TimeField('start_datetime', widget=TimeInput(), validators=[DataRequired()]) end_date = DateField('end_datetime', widget=DateInput(), validators=[DataRequired()]) end_time = TimeField('end_datetime', widget=TimeInput(), validators=[DataRequired()]) description = TextAreaField('description', validators=[DataRequired()]) private = BooleanField('private') submit = SubmitField()
class AppointmentForm(FlaskForm): name= StringField('Name',validators=[DataRequired()]) start_date= DateField('Start Date',validators=[DataRequired()], widget=DateInput()) start_time= TimeField('Start Time',validators=[DataRequired()], widget=TimeInput()) end_date= DateField('End Date',validators=[DataRequired()], widget=DateInput()) end_time= TimeField('End Time',validators=[DataRequired()], widget=TimeInput()) description= TextAreaField('Description',validators=[DataRequired()]) private= BooleanField('Private') submit= SubmitField('Create Appointment') def validate_end_date(form, field): start = datetime.combine(form.start_date.data, form.start_time.data) # end = datetime.combine(field.data, form.end_time.data) print(field) end = datetime.combine(form.end_date.data, form.end_time.data) if start >= end: msg = "End date/time must come after start date/time" raise ValidationError(msg)
class AppointmentForm(FlaskForm): name = StringField('Name', validators) start_date = DateField('Start date', validators, widget=DateInput()) start_time = TimeField('Start time', validators, widget=TimeInput()) end_date = DateField('End date', validators, widget=DateInput()) end_time = TimeField('End time', validators, widget=TimeInput()) description = TextAreaField('Description', validators) private = BooleanField('Private?') submit = SubmitField('Create an appointment') def validate_end_date(form, field): start = datetime.combine(form.start_date.data, form.start_time.data) end = datetime.combine(form.end_date.data, form.end_time.data) if start >= end: raise ValidationError( 'End date/time must come after start date/time') if form.start_date.data != form.end_date.data: raise ValidationError('End date must be the same as start date')
class AuctionForm(FlaskForm): name = StringField('name of the auction', validators=[DataRequired()]) category = SelectField('Category', choices=choices) city = StringField("City", validators=[DataRequired()]) minimal_price = IntegerField("Minimum price") auction_image = FileField("Auction image", validators=[FileRequired()]) end_date = StringField("End date", validators=[InputRequired()]) end_time = TimeField("End time", validators=[InputRequired()]) description = StringField("Description", validators=[DataRequired()])
class ArticleForm(FlaskForm): name = StringField('Name of Article', validators=[DataRequired()]) category = SelectField(u'Category', choices=choices) town = StringField('Town', validators=[DataRequired()]) minimal_price = IntegerField('Minimal price') article_image = FileField('Article_image', validators=[FileRequired()]) end_day = StringField('End Date', validators=[InputRequired()]) # String converted to date end_time = TimeField('End Time', validators=[InputRequired()]) description = TextAreaField('Description', validators=[DataRequired()])
class AppointmentForm(FlaskForm): name = StringField("Name", v) start_date = DateField("Start date", v, **di) start_time = TimeField("Start time", v, **sti) end_date = DateField("End date", v, **di) end_time = TimeField("End time", v, **eti) description = TextAreaField("Description", v) private = BooleanField("Private?") submit = SubmitField("Create an appointment") def validate_end_date(form, field): start = datetime.combine(form.start_date.data, form.start_time.data) end = datetime.combine(field.data, form.end_time.data) if start >= end: msg = "End date/time must come after start date/time" raise ValidationError(msg) if form.start_date.data != form.end_date.data: msg = "End date must be the same as start date" raise ValidationError(msg)
class ProductRegistrationForm(FlaskForm): name = StringField('Name of the Product', validators=[DataRequired()]) description = TextAreaField('Description', validators=[DataRequired()]) category = SelectField('Category', choices=product_categories) base_price = FloatField('Base price') article_image = FileField('Product Image', validators=[FileRequired()]) is_biddable = SelectField('Is Product up for Bid ?', choices=[('True', 'Yes'), ('False', 'No')]) bid_end_day = DateField('Select Bid End Date', format='%d-%m-%Y') bid_end_time = TimeField('Select Bid End Date and Time', format='%H:%M')
class SessionPlanScheduleFilterForm(FlaskForm): items_per_page = IntegerField(lazy_gettext('Items per page')) q = StringField(lazy_gettext('Search')) obj_source = HiddenField('obj_source', default='WL') constellation_id = IntegerField('Constellation', default=None) dso_type = SelectField(lazy_gettext('Object type'), choices=[ ('All', 'All types'), ('GX', 'Galaxy'), ('GC', 'Globular Cluster'), ('OC', 'Open Cluster'), ('BN', 'Nebula'), ('PN', 'Planetary Nebula'), ], default='') maglim = IntegerField(lazy_gettext('Limit mag'), default=12) min_altitude = IntegerField(lazy_gettext('Min altitude'), default=5) items_per_page = IntegerField(lazy_gettext('Items per page')) time_from = TimeField('Time From', format=SCHEDULE_TIME_FORMAT) time_to = TimeField('Time From', format=SCHEDULE_TIME_FORMAT) not_observed = BooleanField('Not observed', default='checked') selected_dso_name = HiddenField(default='M1')
class AppointmentForm(FlaskForm): name = StringField(label='Name', validators=[InputRequired()]) start_date = DateField('Start date', validators=[ InputRequired()], widget=DateInput()) start_time = TimeField('Start time', validators=[ InputRequired()], widget=TimeInput()) end_date = DateField('End date', validators=[ InputRequired()], widget=DateInput()) end_time = TimeField('End time', validators=[ InputRequired()], widget=TimeInput()) description = TextAreaField('Description', validators=[InputRequired()]) private = BooleanField('Private?') submit = SubmitField('Create an Appointment') def validate_end_date(form, field): end = datetime.combine(form.end_date.data, form.end_time.data) start = datetime.combine(form.start_date.data, form.start_time.data) if form.end_date.data != form.start_date.data: msg = 'Appointment must start and end on the same day' raise ValidationError(msg) if start >= end: msg = "End data/time must come after start date/time" raise ValidationError(msg)
class PoolForm(FlaskForm): from_ = StringField( 'from_', validators=[ DataRequired(message='Please specify a pool source'), Length(min=1, max=32, message='Please specify a valid source'), ]) to_ = StringField( 'to_', validators=[ DataRequired(message='Please specify a pool destination'), Length(min=1, max=32, message='Please specify a valid address'), ]) date = DateField('date', validators=[ DataRequired(message='Please specify a pool date'), ]) time = TimeField('time', validators=[ DataRequired(message='Please specify a pool time'), ]) vehicle = StringField( 'vehicle', validators=[ DataRequired(message='Please specify a pool vehicle'), Length(min=1, max=32, message='Please specify a valid vehicle'), ]) spots = IntegerField( 'spots', validators=[ DataRequired(message='Please specify the number of pool spots'), NumberRange(min=1, max=5, message='Please specify a number between 1 and 5'), ]) submit = SubmitField('Create New Request')
class F(Form): a = TimeField() b = TimeField(format="%H:%M")