class CreateAppointmentForm(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): end = datetime.combine(form.end_date.data, form.end_time.data) start = datetime.combine(form.start_date.data, form.start_time.data) if start >= end: raise ValidationError('Start must come before end!') if form.end_date.data != form.start_date.data: raise ValidationError( 'Start date and end date must be the same day!')
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 EducationAndPublicEngagementForm(FlaskForm): project_name = StringField("Project name", description={"placeholder": "Project name"}) start_date = StringField("Start Date", widget=DateInput()) end_date = StringField("Start Date", widget=DateInput()) activity_type = StringField("Activity Type", description={"placeholder": "Activity type"}) project_topic = StringField("Project Type", description={"placeholder": "Project topic"}) target_graphical_area = StringField("Target Graphical Area", description={"placeholder": "Target graphical area"}) primary_attribution = IntegerField("Primary Attribution", description={"placeholder": "Primary attribution"})
class AcademicCollaborationForm(FlaskForm): start_date = StringField("Start Date", widget=DateInput()) end_date = StringField("Start Date", widget=DateInput()) institution = StringField("Institution", description={"placeholder": "Institution"}) location = StringField("Location", description={"placeholder": "Location"}) collaborator_name = StringField("Collaborator Name", description={"placeholder": "Collaborator name"}) primary_goal = StringField("Primary Goal", description={"placeholder": "Primary goal"}) interaction_frequency = IntegerField("Interaction Frequency", validators=[NumberRange(min=0, max=100)]) primary_attribution = IntegerField("Primary Attribution", description={"placeholder": "Primary attribution"})
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 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(self, field): start = datetime.combine(self.start_date.data, self.start_time.data), end = datetime.combine(field.data, self.end_time.data), if start >= end: raise ValidationError("End date/time must come after start date/time") if not self.start_date.data == field.data: raise ValidationError("End date must the be the same as start date")
class ReportForm(FlaskForm): main_teacher = SelectField('Main Teacher', validators=[DataRequired()], coerce=int) assistant_teacher = SelectField('Assistant Teacher', validators=[Optional()], coerce=int) teaching_date = DateField('Teaching Date', validators=[DataRequired()], widget=DateInput()) teaching_content = TextField('Teaching Content', validators=[DataRequired(), Length(max=200)], widget=TextArea()) student_attendance = StringField('Student Attendance', validators=[DataRequired()], widget=NumberInput(step=1)) submitted_by = SelectField('Submitted By', validators=[DataRequired()], coerce=int) submit = SubmitField('Submit Report') def validate_assistant_teacher(self, teacher): if teacher.data == self.main_teacher.data: raise ValidationError( 'Assitant and main teachers can\'t be the same.') def validate_teaching_date(self, date): if date.data > datetime.now().date(): raise ValidationError('Cannot have date in the future.') def validate_student_attendance(self, attendance): if int(attendance.data) <= 0: raise ValidationError('Student attendance cannot be 0.')
class Buiform(FlaskForm): username = StringField(label='用户名', validators=[DataRequired('请输入用户名')], description='用户名', render_kw={'class': 'control-text', 'placeholder': '输入用户名', 'required': "required"}) optSelectMultipleField = optSelectMultipleField('optMS', choices=( ('Fruits', ( ('apple', 'Apple'), ('peach', 'Peach'), ('pear', 'Pear') )), ('Vegetables', ( ('cucumber', 'Cucumber'), ('potato', 'Potato'), ('tomato', 'Tomato'), )) ), default=('cpp', 'C++')) SelectMultipleField = SelectMultipleField('MS', choices=[('cpp', 'C++'), ('py', 'Python'), ('text', 'Plain Text'), ('cpp1', 'C1++'), ('py1', 'Python1'), ('text1', 'Plain Text1')], default=('cpp', 'C++')) dt = DateField('日期') dt1 = DateTimeField('datetime', widget=DateInput()) RadioField = RadioField('RadioField', choices=[('cpp', 'C++'), ('py', 'Python'), ('text', 'Plain Text')]) city1 = SelectField('省', choices=[('cpp', 'C++'), ('py', 'Python'), ('text', 'Plain Text')]) select = SelectField('单选', choices=[('cpp', 'C++'), ('py', 'Python'), ('text', 'Plain Text')]) password = PasswordField('新密码') submit = SubmitField('提交查询')
class ProfileForm(Form): first_name = StringField( 'First name', [validators.DataRequired(), validators.Length(min=3, max=64)]) last_name = StringField( 'Last name', [validators.DataRequired(), validators.Length(min=3, max=64)]) phone_number = TelField( 'Phone number', [validators.DataRequired(), validators.Length(min=5, max=15)]) birthdate = DateField('Date of Birth', [validators.DataRequired()], widget=DateInput()) gender = SelectField('Gender', choices=[('1', Gender.Male.name), ('0', Gender.Female.name)]) def set(self, user): self.first_name.data = user.first_name self.last_name.data = user.last_name self.phone_number.data = user.phone_number self.birthdate.data = user.birthdate self.gender.data = '1' if user.gender == Gender.Male else '0' def to_user(self, user=None): if not user: user = User() user.first_name = self.first_name.data user.last_name = self.last_name.data user.phone_number = self.phone_number.data user.birthdate = self.birthdate.data user.gender = Gender.Male if self.gender.data == '1' else Gender.Female return user
class EventForm(Form): course = SelectField('Course', [validators.InputRequired()], coerce=int, validate_choice=False) date = StringField('Date', [validators.InputRequired()], widget=DateInput()) submit = SubmitField('Create')
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 GetReportsAdminForm(FlaskForm): from_date = DateField('From', validators=[DataRequired()], widget=DateInput()) to_date = DateField('To', validators=[DataRequired()], widget=DateInput()) submit = SubmitField('Get Report') def validate_from_date(self, date): if self.to_date.data: if date.data > self.to_date.data: raise ValidationError( '"from date" cannot be greater than "to date"') def validate_to_date(self, date): if self.from_date.data: if date.data < self.from_date.data: raise ValidationError( '"to date" cannot be lesser than "from date"')
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 ExpenseForm(Form): image = HiddenField() url = HiddenField() price = DecimalField(widget=NumberInput()) currency = SelectField(choices=app.config['EXPENSES_CURRENCY']) concept = SelectField(choices=app.config['EXPENSES_CONCEPT']) date = DateField(validators=[DataRequired()], widget=DateInput()) submit = SubmitField('Submit') remove = SubmitField('Delete')
class PegawaiForm(FlaskForm): name = StringField('Nama Pegawai', validators=[DataRequired()]) nip = IntegerField('NIP/NRP', validators=[DataRequired()]) hp = IntegerField('Nomor WA (menggunakanan awalan 62)') jabatan = QuerySelectField('Jabatan', query_factory=lambda: Jabatan.query.all(), get_label='name', allow_blank=True) pangkat = QuerySelectField('Pangkat', query_factory=lambda: Pangkat.query.all(), get_label='name', allow_blank=True) foto = FileField( 'Upload Foto', validators=[FileAllowed(['jpg', 'jpeg', 'png'], 'File gambar saja')]) tmt_kp = DateField('TMT Kenaikan Pangkat (mm/dd/yyy)', widget=DateInput()) tmt_kgb = DateField('TMT Kenaikan Gaji Berkala (mm/dd/yyy)', widget=DateInput()) submit = SubmitField('Simpan')
class DateField(DateTimeField): """ Same as DateTimeField, except stores a date """ widget = DateInput() ERROR = 'Not a valid date value' def __init__(self, format="YYYY-MM-DD", **kwargs): super(DateField, self).__init__(**kwargs) self.format = format
class SignUpForm(FlaskForm): first_name = StringField('first name', validators=[DataRequired()]) last_name = StringField('last name', validators=[DataRequired()]) username = StringField('username', validators=[DataRequired()]) birthday = DateField('Birthday', validators=[DataRequired()], widget=DateInput()) email = StringField('email', validators=[DataRequired(), user_exists]) password = StringField('password', validators=[DataRequired()]) submit = SubmitField("Create Account")
class Form_hoa_don(FlaskForm): ma_don_hang = fields.StringField('Mã đơn hàng:') kenh_ban = fields.SelectField( choices=[('Sendo', 'Sendo'), ('Shopee', 'Shopee'), ( 'Lazada', 'Lazada'), ('Khác', 'Khác'), ('Người quen', 'Người quen'), ('Facebook', 'Facebook'), ('Zalo', 'Zalo')]) ho_ten = fields.StringField('Tên khách hàng:') ngay_tao = fields.DateField('Ngày:', widget=DateInput()) dia_chi = fields.StringField('Địa chỉ:') so_dien_thoai = fields.StringField('Số điện thoại:') giam_gia = fields.FloatField('Giảm giá:') nha_van_chuyen = fields.SelectField('Hãng ship:', choices=[('GHN', 'GHN'), ('Viettel', 'Viettel Post'), ('VNC', 'VNC'), ('NJV', 'Ninja Van'), ('LEX', 'Lazada Express'), ('VNPost', 'VN Post'), ('Others', 'Khác')]) ma_van_don = fields.StringField('Mã vận đơn:') phi_van_chuyen = fields.FloatField('Phí ship:') ghi_chu = fields.TextField('Ghi chú:') submit = fields.SubmitField('Kế tiếp') def tao_khach_hang(self): khach_hang = Khach_hang() khach_hang.ten_khach_hang = self.ho_ten.data.strip().lower() khach_hang.dia_chi = self.dia_chi.data.strip().lower() khach_hang.dien_thoai = self.so_dien_thoai.data.strip() db.session.add(khach_hang) db.session.commit() return khach_hang.get_id() def tao_hoa_don(self, ngay_tao, ma_kh): hoa_don = Hoa_don() hoa_don.ma_hoa_don_kenh_ban = self.ma_don_hang.data.strip() hoa_don.ngay_tao_hoa_don = ngay_tao hoa_don.ma_khach_hang = ma_kh hoa_don.tong_tien = 0 hoa_don.kenh_ban = self.kenh_ban.data hoa_don.nha_van_chuyen = self.nha_van_chuyen.data hoa_don.ma_van_don = self.ma_van_don.data.strip() hoa_don.phi_van_chuyen = self.phi_van_chuyen.data hoa_don.ghi_chu = self.ghi_chu.data hoa_don.giam_gia = self.giam_gia.data db.session.add(hoa_don) db.session.commit() return hoa_don.get_id()
class F(Form): order_name = StringField('Order Name', validators=[DataRequired()]) description = StringField('Description', validators=[DataRequired()]) delivery_date = StringField('Delivery Date', widget=DateInput()) cost_object = StringField('Cost Object', validators=[DataRequired()]) requestor_name = StringField('Requestor Name', validators=[DataRequired()]) requestor_phone = StringField('Requestor Phone', validators=[DataRequired()]) supervisor_name = StringField('Supervisor Name', validators=[DataRequired()]) order_name = StringField('Order Name', validators=[DataRequired()]) submit = SubmitField()
class EntryForm(FlaskForm): visited_date = DateField(widget=DateInput(), validators=[DataRequired()]) visited_time = TimeField(widget=TimeInput(), validators=[DataRequired()]) covid_status = SelectField("Covid Status", validators=[DataRequired()], choices=[(2, 'Tested Positive'), (1, 'Have Symptoms'), (0, 'I\'m not sure')]) last_visited_location = StringField( "Last Visited Location", render_kw={'readonly': ''}, validators=[DataRequired(message="This field is required!")]) last_visited_location_lat_long = HiddenField() submit = SubmitField("Submit")
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 DemoForm(FlaskForm): demo_str = StringField(label='Standard string field') demo_select = SelectField(label='Standard dropdown selector', choices=[('Alt1', '1'), ('Alt2', '2'), ('Alt3', '3')]) demo_radio = RadioField(label='Standard radio buttons selector', choices=[('Alt1', 'Select 1'), ('Alt2', 'Select 2'), ('Alt3', 'Select 3')]) demo_boolean = BooleanField(label="Standard Yes/No (boolean) field") demo_date = DateField(label='Standard date field', widget=DateInput()) demo_datetime = DateTimeField(label='Standard date and time field', widget=DateTimeLocalInput()) demo_email = StringField(label='Email input field', widget=EmailInput()) demo_textarea = TextAreaField(label='Textarea for more exhaustive input') demo_range = IntegerField(label='Range field', widget=RangeInput())
class EntryForm(Form): """ Form for adding or updating entries """ id = HiddenField() title = StringField( 'Title', default='', validators=[ validators.DataRequired(), validators.Length( max=100, message='The title can only be 100 characters long'), customvalidators.title_exists(models.Entry, 'Entry') ], filters=[lambda x: x.strip()], ) date = customfields.DateField( 'Date', default=datetime.datetime.now().date().strftime('%Y-%m-%d'), widget=DateInput() ) tags = customfields.ChosenSelectField( "Select Tags", choice_func=models.get_tag_choices, widget=customwidgets.ChosenSelect(multiple=True)) time_spent = customfields.TimeField( 'Enter Time Spent as HH:MM (Hours:Minutes)', default='01:00', widget=customwidgets.TimeInput() ) learned = TextAreaField( 'Enter your markdown', validators=[validators.DataRequired()], widget=customwidgets.MarkupTextArea(cssid='learned') ) resources = customfields.ChosenSelectField( "List Resources", choice_func=models.get_resource_choices, widget=customwidgets.ChosenSelect(multiple=True))
class UrlForm(FlaskForm): url = StringField(lazy_gettext('Feed address'), validators=[DataRequired()]) frequency = SelectField(lazy_gettext('Frequency'), choices=[('daily', lazy_gettext('Daily')), ('weekly', lazy_gettext('Weekly')), ('monthly', lazy_gettext('Monthly')), ('custom_days', lazy_gettext('Select week days:'))], default = 'weekly') custom_day_mon = BooleanField(lazy_gettext('Monday')) custom_day_tue = BooleanField(lazy_gettext('Tuesday')) custom_day_wed = BooleanField(lazy_gettext('Wednesday')) custom_day_thu = BooleanField(lazy_gettext('Thursday')) custom_day_fri = BooleanField(lazy_gettext('Friday')) custom_day_sat = BooleanField(lazy_gettext('Saturday')) custom_day_sun = BooleanField(lazy_gettext('Sunday')) start_date = DateField(lazy_gettext('Start date'), widget = DateInput(), default = datetime.date.today) start_date_timezone = SelectField(lazy_gettext('Timezone'), choices=generate_timezone_list()) option_start_at = IntegerField(lazy_gettext('Start from episode #'), validators = [DataRequired()], widget = NumberInput(min=1), default = 1) option_format = RadioField(lazy_gettext('Feed Format'), default = 'feed_rss', choices=[ ('feed_rss',lazy_gettext('RSS')), ('feed_atom',lazy_gettext('Atom')), ('feed_json',lazy_gettext('JSON Feed'))]) option_order = RadioField(lazy_gettext('Order'), default = 'asc', choices=[ ('asc',lazy_gettext('Oldest first')), ('desc',lazy_gettext('Newest first'))]) option_keepdates = BooleanField(lazy_gettext('Keep original publication dates'))
class LogLiftForm(FlaskForm): movement = SelectField( "Barbell Movement", choices=[ ('01','Front Squat'), ('02','Back Squat'), ('03','Overhead Squat'), ('04','Clean (Squat Clean)'), ('05','Power Clean'), ('06','Clean & Jerk'), ('07','Deadlift'), ('08','Snatch (Squat Snatch)'), ('09','Power Snatch'), ('10','Strict Press'), ('11','Push Press'), ('12','Push Jerk'), ('13','Thruster'), ('14','Bench Press'), ] ) rep = IntegerField("How many unbroken reps?", widget=TelInput()) load = IntegerField("How much weight did you lift?",widget=TelInput()) date = DateField("Date", widget=DateInput()) submit = SubmitField("Log Lift")
class Form_xem_khoan_chi(FlaskForm): tu_ngay = fields.DateField(widget=DateInput()) den_ngay = fields.DateField(widget=DateInput()) submit_2 = fields.SubmitField('Xem')
TextAreaField, TimeField) from wtforms.widgets.html5 import DateInput, TimeInput from wtforms.validators import DataRequired, ValidationError def next_block(delta=0): def time(): now = datetime.now() return now - timedelta(minutes=now.minute % 15 - delta - 15, seconds=now.second) return time v = [DataRequired()] di = {'default': datetime.now, 'widget': DateInput()} sti = {'default': next_block(), 'widget': TimeInput()} eti = {'default': next_block(60), 'widget': TimeInput()} 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):
class TodoBaseForm(FlaskForm): title = StringField("Title", validators=[DataRequired(), Length(max=255)]) text = TextAreaField("Text", validators=[Length(max=3000)]) url = StringField("URL", validators=[URL()]) date = DateField("Date", widget=DateInput(), validators=[DataRequired()])
class BusquedaFechaForm(FlaskForm): fecha = DateField('Fecha', validators=[DataRequired()], widget=DateInput()) submit = SubmitField('Buscar')