class SiteForm(FlaskForm): """ Site Form. Fields: file - binary of media file alt - alt field for seo title - title of site url - url for site content - content """ featured = FileField('featured') alt = StringField('alt') title = StringField('title', validators=[InputRequired()]) url = StringField('title') content = TextAreaField('content', validators=[InputRequired()])
class UpdateBookForm(FlaskForm): allowed_files = {'png', 'PNG', 'jpg', 'JPG'} image = FileField( '', validators=[ FileAllowed( allowed_files, message='The website supports just .png and .jpg files') ]) title = TextAreaField( 'Title', validators=[ InputRequired('Title is required'), Length( min=2, max=100, message="Title must have minimum 2 and maximum 50 characters") ]) author = TextAreaField( 'Author', validators=[ Length(max=40, message="Author must have maximum 40 characters"), InputRequired('Author is required') ]) category = SelectField('Category', choices=[ "", 'Academic', 'Action', 'Adventure', 'Biographies', 'Business', 'Cooking', 'Comic', 'Detective', 'Drama', 'Fantasy', 'Fiction', 'History', 'Kids', 'Poetry', 'Romance', 'Sci-Fi', 'Self-Help', 'Thriller', 'Others' ], validators=[InputRequired('Category is required')]) description = TextAreaField( 'Description', validators=[ Length(max=400, message="Description must have maximum 200 characters") ]) isbn = TextAreaField( 'ISBN', validators=[ Length(max=30, message="ISBN must have maximum 30 characters") ])
class MCategoryForm(FlaskForm): name = StringField("Name", validators=[InputRequired()]) image = FileField( "Image", validators=[InputRequired(), FileAllowed(images, "Images only!")]) order = IntegerField("Order", validators=[InputRequired()]) is_featured = BooleanField("Is Featured ?") parent = QuerySelectField( "Parent Category", get_label="name", allow_blank=True, blank_text="No Parent", query_factory=lambda: db.session.query(MCategory).filter_by( parent_id=None).order_by("name"), ) submit = SubmitField("Submit")
class UserForm(FlaskForm): email = StringField('メール: ', validators=[DataRequired(), Email('メールアドレスが誤っています')]) username = StringField('名前: ', validators=[DataRequired()]) picture_path = FileField('ファイルアップロード') submit = SubmitField('登録情報更新') def validate(self): if not super(FlaskForm, self).validate(): return False user = User.select_user_by_email(self.email.data) if user: if user.id != int(current_user.get_id()): flash('そのメールアドレスはすでに登録されています') return False return True
class RequestReimbursement(Form): advance_date = DateField('date of advance (yyyy-mm-dd)', [ validators.Required( message='please enter a date using the specified formatting') ]) amount = DecimalField('amount advanced (e.g. 1.52)', [ validators.NumberRange(min=0, message='please enter a positive number') ], places=2) description = TextField('description', [validators.Required()]) comments = TextField( 'comments (optional, e.g. how you prefer to be reimbursed)', [validators.Optional()]) attachment = FileField( "add attachment", [FileAllowed(attachments, "This filetype is not whitelisted")]) submit = SubmitField('request reimbursement')
class UserdetailForm(FlaskForm): """ 用户修改资料表单 """ name = StringField(label="账号", validators=[DataRequired("请输入账号!")], description="账号", render_kw={ "class": "form-control", "placeholder": "请输入账号!", }) email = StringField(label="邮箱", validators=[DataRequired("请输入邮箱!"), Email("邮箱格式不正确!")], description="邮箱", render_kw={ "class": "form-control", "placeholder": "请输入邮箱!", }) phone = StringField(label="手机", validators=[ DataRequired("请输入手机!"), Regexp("1[3458]\\d{9}", message="手机格式不正确!") ], description="手机", render_kw={ "class": "form-control", "placeholder": "请输入手机!", }) face = FileField( label="头像", validators=[DataRequired("请上传头像!")], description="头像", ) info = TextAreaField(label="简介", validators=[DataRequired("请输入简介!")], description="简介", render_kw={ "class": "form-control", "rows": 10 }) submit = SubmitField(label='保存修改', render_kw={ "class": "btn btn-success", })
class UserdetailForm(FlaskForm): name = StringField(label="昵称", validators=[DataRequired("请输入昵称!")], description="昵称", render_kw={ "id": "input_name", "class": "form-control input-lg", "placeholder": "昵称", }) email = StringField(label="邮箱", validators=[DataRequired("请输入邮箱!"), Email("邮箱格式不正确!")], description="邮箱", render_kw={ "id": "input_email", "class": "form-control input-lg", "placeholder": "邮箱", }) phone = StringField(label="手机号码", validators=[ DataRequired("请输入手机号码!"), Regexp("1[34578][0-9]{9}", message="手机号码格式不正确") ], description="手机号码", render_kw={ "id": "input_phone", "class": "form-control input-lg", "placeholder": "手机号码", }) face = FileField(label='头像', validators=[DataRequired("请选择头像!")], description="头像", render_kw={ "id": "input_face", "class": "form-control" }) info = TextAreaField(label='简介', validators=[DataRequired("请输入简介!")], description="简介", render_kw={ "class": "form-control", "rows": "10", "id": "input_info" }) submit = SubmitField('保存修改', render_kw={"class": "btn btn-success"})
class UserdetailForm(FlaskForm): name = StringField( label='昵称', validators=[DataRequired('请输入昵称!')], # 验证 description="昵称", render_kw={ 'class': 'form-control', 'placeholder': '请输入昵称!', }) email = StringField( label='邮箱', validators=[DataRequired('请输入邮箱'), Email('邮箱格式不正确!')], # 验证 description="邮箱", render_kw={ 'class': 'form-control', 'placeholder': '请输入邮箱!', }) phone = StringField( label='手机', validators=[ DataRequired('请输入手机号码!'), Regexp('1[3458]\\d{9}', message='手机格式不正确!') ], # 验证 description="手机", render_kw={ 'class': 'form-control', 'placeholder': '请输入手机!', }) face = FileField( label='头像', validators=[DataRequired('请上传头像!')], description='头像', ) info = TextAreaField(label="简介", validators=[DataRequired("请输入简介!")], description="简介", render_kw={ "class": "form-control", "rows": 10, "id": "input_info" }) submit = SubmitField('提交修改', render_kw={ 'class': 'btn btn-success', })
class PatientForm(FlaskForm): company_id = SelectField('Company', choices=[(i.id, i.name) for i in db.session.query(Company).all() ], coerce=int) first_name = StringField(validators=[DataRequired(), Length(max=50)]) last_name = StringField(validators=[DataRequired(), Length(max=100)]) email = EmailField(validators=[DataRequired(), Email(), Length(max=255)]) date_of_birth = MyDateField(validators=[DataRequired()]) gender = RadioField(choices=[(i.value, i.name) for i in Gender], coerce=int) photo = FileField(validators=[DataRequired()], render_kw={'accept': 'image/*'}) def validate_email(form, field): if db.session.query(Patient).filter_by(email=field.data).count() > 0: raise ValidationError('Patient already exists')
class ProfileEditForm(FlaskForm): teamname = StringField("Team Name", validators=[ InputRequired("Please enter a team name."), TeamLengthValidator ]) school = StringField( "School", validators=[ InputRequired("Please enter your school."), Length( 3, 36, "Your school name must be between 3 and 36 characters long. Use abbreviations if necessary." ) ]) avatar = FileField("Avatar") remove_avatar = BooleanField("Remove Avatar") submit = SubmitField("Update Profile")
class UserForm(FlaskForm): email = StringField( 'Email Address: ', validators=[DataRequired(), Email('Wrong email address')]) username = StringField('Username: '******'File Upload') submit = SubmitField('Update Registration Info') def validate(self): if not super(FlaskForm, self).validate(): return False user = User.select_user_by_email(self.email.data) if user: if user.id != int(current_user.get_id()): flash('Email address does not exist') return False return True
class AgreementAnswerSubmissionForm(IndicoForm): answer = IndicoRadioField(_("Answer"), [InputRequired()], coerce=lambda x: bool(int(x)), choices=[(1, _("Agreement")), (0, _("Disagreement"))]) document = FileField( _("Document"), [UsedIf(lambda form, field: form.answer.data), DataRequired()]) upload_confirm = BooleanField( _("I confirm that I'm uploading a document that clearly shows this person's answer" ), [UsedIf(lambda form, field: form.answer.data), DataRequired()]) understand = BooleanField( _("I understand that I'm answering the agreement on behalf of this person" ), [DataRequired()], description=_("This answer is legally binding and can't be changed " "afterwards."))
class CreateListingForm(FlaskForm): # Variables categories = ['Acoustic Guitar', 'Electric/Rock Guitar', 'Bass Guitar', 'Piano/Keyboard', 'Drums & Percussion', 'Electronic/MIDI/Synth', 'Orchestra/Strings', 'Jazz/Woodwind', 'Studio Hardware/Recording', "DJ Mixers/CDJ's", 'Other'] categories_list = [(status, status) for status in categories] ALLOWED_FILE = {"png", "jpg", "jpeg", "JPG", "PNG"} # Objects title = StringField('Listing Title:', validators=[InputRequired("Please enter in the title of the listing."), Length(max=100)], render_kw={"placeholder": "*Enter title*"}) startingBid = IntegerField("Starting minimum bid (minimum $1):", validators=[InputRequired("Please enter a valid starting bid price"), NumberRange(min=1, message="Please enter a valid starting price (minimum $1), rounded to a whole dollar")], render_kw={"placeholder": "$0"}) instrument = StringField('Instrument:', validators=[InputRequired("Please enter in the instrument."), Length(max=100, message = "You have exceed the character count (100).")], render_kw={"placeholder": "*Enter instrument (example: Nylon Guitar)*"}) category = SelectField('Category:', choices=categories_list, default=1) model = StringField('Model:', validators=[InputRequired("Please enter in the model."), Length(max=100, message = "You have exceed the character count (100).")], render_kw={"placeholder": "*Insert the model/model number*"}) brand = StringField('Brand:', validators=[InputRequired("Please enter in the brand."), Length(max=100, message = "You have exceed the character count (100).")], render_kw={"placeholder": "*Enter brand name*"}) year = IntegerField('Year:', validators=[DataRequired(), NumberRange(min = 1000, max = 2020, message = "Please enter a valid year.")], render_kw={"placeholder": "*YYYY*"}) colour = StringField('Colour:', validators=[InputRequired("Please enter in the colour(s)."), Length(min = 2, max = 100, message = "Please enter a valid colour.")], render_kw={"placeholder": "*Enter colour*"}) description = TextAreaField("Description:", validators = [InputRequired("Please enter in a brief description"), Length(max=750, message = "You have exceeded your character count (750)")], render_kw={"placeholder": "*Insert any additional information about the listing here (up to 750 characters)*", "rows": "5"}) image = FileField('Add image:', validators=[FileRequired(message='You must provide an image'), FileAllowed(ALLOWED_FILE, message='Only supports png, jpg, JPG, PNG')]) submit = SubmitField("Create & Publish Listing")
class UserForm(FlaskForm): email = StringField( 'Mail: ', validators=[DataRequired(), Email('Your address is not correct.')]) username = StringField('Name: ', validators=[DataRequired()]) picture_path = FileField('File upload') submit = SubmitField('Update your info') def validate(self): if not super(FlaskForm, self).validate(): return False user = User.select_user_by_email(self.email.data) if user: if user.id != int(current_user.get_id()): flash('This address is already registered.') return False return True
class JournalForm(FlaskForm): from_user_id = HiddenField() start_date = DateField('Start', format='%Y/%m/%d', validators=[DataRequired()]) end_date = DateField('End', format='%Y/%m/%d', validators=[DataRequired()]) country = SelectField('Country', choices=[('Brazil'), ('Canada'), ('Japan'), ('Singapore'), ('Spain')], validators=[DataRequired()]) city = SelectField('City', choices=[('Barcelona'), ('Kyoto'), ('Rio de Janeiro'), ('Singapore'), ('Vancouver')], validators=[DataRequired()]) title = StringField('Title', validators=[DataRequired()]) comment = TextAreaField('Journal', validators=[DataRequired()]) picture_path = FileField('Picture', validators=[DataRequired()]) submit = SubmitField('Submit')
class UserDetailForm(FlaskForm): name = StringField(label='昵称', validators=[ DataRequired("请输入昵称"), ], description="昵称", render_kw={ "class": "form-control ", "placeholder": "请输入昵称!", }) email = StringField(label="邮箱", validators=[DataRequired("请输入邮箱"), Email('邮箱格式不正确')], description="邮箱", render_kw={ "class": "form-control ", "placeholder": "请输入邮箱!", }) phone = StringField(label="手机号码", validators=[ DataRequired("请输入手机号码"), Regexp('1[3578]\\d{9}', message='手机格式不正确') ], description="手机号码", render_kw={ "class": "form-control ", "placeholder": "请输入手机号码!", }) face = FileField( label="头像", validators=[DataRequired("请上传头像")], description="头像", ) info = TextAreaField(label='简介', validators=[DataRequired("请输入简介")], description="简介", render_kw={ "class": "form-control", "rows": 10, }) submit = SubmitField('保存修改', render_kw={ "class": "btn btn-success form-control ", })
class UpdateAccountForm(FlaskForm): username = StringField('Username', validators=[DataRequired(), Length(min=5, max=30)]) email = StringField('Email', validators=[DataRequired(), Email()]) pfp_file = FileField( 'Profile picture', validators=[FileAllowed(['jpg', 'jpeg', 'png', 'gif'])]) submit = SubmitField('Update info') # check that the username isn't taken def validate_username(self, username): if current_user.username != username.data: if User.query.filter_by(username=username.data).first(): raise ValidationError( 'That username is taken. Please choose a different one.')
class UserdetailForm(FlaskForm): name = StringField(label='昵称', validators=[DataRequired("请输入昵称!")], description="昵称", render_kw={ "class": "form-control", "placeholder": "请输入昵称!", }) email = StringField(label='邮箱', validators=[DataRequired("请输入邮箱!"), Email("邮箱格式不正确!")], description="邮箱", render_kw={ "class": "form-control", "placeholder": "请输入邮箱!", }) phone = StringField(label='手机号码', validators=[ DataRequired("请输入手机号码!"), Regexp("1[3458]\\d{9}", message="号码格式不正确!") ], description="手机号码", render_kw={ "class": "form-control", "placeholder": "请输入手机号码!", }) info = TextAreaField(label="简介", validators=[DataRequired("请输入简介!")], description="简介", render_kw={ "class": "form-control", "rows": 10 }) face = FileField( label="头像", validators=[], description="头像", ) submit = SubmitField('保存修改', render_kw={"class": "btn btn-success"})
class ProjectProposalDevelopmentSupportForm(ModelForm): class Meta: model = ProjectProposalDevelopmentSupport qualifications = [(c, c) for c in ( 'บุคลากรสถาบันฯและไม่อยู่ระหว่างลาศึกษา/ไปปฏิบัติงานเพื่อเพิ่มพูนความรู้', 'เป็นหัวหน้าโครงการวิจัย / ผู้อำนวยการแผนงานวิจัย โดยระบุชื่อหน่วยงานของสถาบันอย่างชัดเจน' )] qualification_select = MultiCheckboxField( 'คุณสมบัติของผู้ขอรับการสนับสนุนตามประกาศฯ', choices=qualifications) docs_select = MultiCheckboxField( 'หลักฐานประกอบการขอรับเงินสนับสนุน', choices=[(i, i) for i in ( 'หลักฐานการชำระเงินโดยต้องระบุชื่อผู้รับการสนับสนุนเช่น ใบเสร็จรับเงิน หรือหลักฐานการโอนเงิน (ฉบับจริง) หากเป็นสำเนาต้องรับรองสำเนาถุกต้องและลงชื่อกำกับ', 'ใบสำคัญรับเงินจากผู้ทรงคุณวุฒิพร้อมระบุลักษณะการตรวจ (ให้คำปรึกษาเพื่อพัฒนาโครงการวิจัยหรือแผนงานวิจัยและสถิติวิจัย) ต้องระบุชื่อโครงการวิจัยหรือแผนงานวิจัยพร้อมลงนามกำกับ', 'สำเนาหนังสือรับรองจริยธรรมวิจัยในคน', 'สำเนาโครงการวิจัยหรือแผนงานวิจัยที่ผ่านการพิจารณาจากคณะกรรมการจริยธรรมการวิจัยในคน', )]) contract_upload = FileField('Upload เอกสารสัญญา')
class UserdatailForm(FlaskForm): name = StringField(label="昵称", validators=[DataRequired("请输入昵称!!!")], description="昵称", render_kw={ "class": "form-control", "placeholder": "请输入昵称!", }) email = StringField( label="邮箱", validators=[DataRequired("请输入邮箱!!!"), Email('邮箱格式不正确')], description="邮箱", render_kw={ "class": "form-control", "placeholder": "请输入邮箱!", }) phone = StringField(label="手机", validators=[ DataRequired("请输入手机!!!"), Regexp('^1[3|4|5|6|7|8][0-9]\d{4,8}$', message='手机格式不正确!!!') ], description="手机", render_kw={ "class": "form-control", "placeholder": "请输入手机!", }) face = FileField( label="头像", validators=[DataRequired("请上传头像!")], description="头像", ) info = TextAreaField(label="简介", validators=[DataRequired("请输入简介!")], description="简介", render_kw={ "class": "form-control", "rows": 10 }) submit = SubmitField('保存修改', render_kw={ "class": "btn btn-success", })
class UserDetailForm(FlaskForm): name = StringField(label="账号", validators=[DataRequired("请输入账号")], description="账号", render_kw={ "class": "form-control", "placeholder": "请输入账号!" }) email = StringField( label="邮箱", validators=[DataRequired("请输入邮箱"), Email("邮箱格式不正确")], description="邮箱", render_kw={ "class": "form-control", "placeholder": "请输入邮箱!", # "required": 'required' }) phone = StringField(label="手机", validators=[ DataRequired("请输入手机号"), Regexp("1[3458]\d{9}", message="手机格式不正确") ], description="手机", render_kw={ "class": "form-control", "placeholder": "请输入手机号!" }) face = FileField( label="文件", validators=[DataRequired("请上传文件!")], description="文件", ) info = TextAreaField(label="简介", validators=[DataRequired("请输入简介!")], description="片名", render_kw={ "class": "form-control", "row": "10!" }) submit = SubmitField( '保存修改', render_kw={"class": "btn btn-success btn-block btn-flat"})
class UserdetailForm(FlaskForm): name = StringField(label='昵称', validators=[DataRequired('请输入昵称')], description='昵称', render_kw={ 'class': 'form-control input-lg', 'placeholder': '请输入昵称' }) email = StringField(label='邮箱', validators=[DataRequired('请输入邮箱'), Email('邮箱格式不正确')], description='邮箱', render_kw={ 'class': 'form-control input-lg', 'placeholder': '请输入邮箱' }) phone = StringField(label='手机号', validators=[ DataRequired('请输入手机号'), Regexp('1[3,4,5,7,8]\\d{9}', message='手机号格式不正确') ], description='手机号', render_kw={ 'class': 'form-control input-lg', 'placeholder': '请输入手机号' }) face = FileField( label='头像', validators=[DataRequired('请上传头像')], description='头像', ) info = TextAreaField(label='介绍', validators=[DataRequired('请输入简介')], description='介绍', render_kw={ 'class': 'form-control', 'rows': '10', }) submit = SubmitField('保存修改', render_kw={'class': 'btn btn-success'})
class UserDetailForm(FlaskForm): name = StringField(label='昵称', validators=[DataRequired('请输入昵称')], description='昵称', render_kw={ "class": "form-control", "placeholder": "昵称", }) email = StringField(label='邮箱', validators=[DataRequired('请输入邮箱'), Email('邮箱格式不正确')], description='邮箱', render_kw={ "class": "form-control", "placeholder": "邮箱", }) phone = StringField(label='手机号', validators=[ DataRequired('请输入手机号'), Regexp(r'1[345678]\d{9}', message='手机格式不正确') ], description='手机号', render_kw={ "class": "form-control", "placeholder": "手机号", }) face = FileField(label='头像', description='头像', render_kw={"placeholder": "头像"}) info = TextAreaField(label='简介', validators=[DataRequired('请输入简介!')], description='简介', render_kw={ "class": "form-control", "rows": "10" }) submit = SubmitField(label="保存修改", render_kw={"class": "btn btn-success"})
class ProfileForm(Form): firstname = TextField('Firstname', validators=[Required()]) lastname = TextField('Lastname', validators=[Required()]) password = PasswordField('Password', validators=[ Required(), EqualTo('confirm', message='Passwords must match') ]) confirm = PasswordField('Repeat Password') age = IntegerField('Age', validators=[Required()]) sex = SelectField('Sex', choices=[('Male', 'Male'), ('Female', 'Female')], validators=[Required()]) image = FileField( 'Profile Photo', validators=[FileRequired(), FileAllowed(['jpg,png'], 'Images Only!')]) biography = TextField('Biography', validators=[Required()])
class UserdetailForm(FlaskForm): """会员中心表单""" name = StringField(label="昵称", validators=[DataRequired("请输入昵称!")], description="昵称", render_kw={ "class": "form-control", "placeholder": "请输入昵称!" }) email = StringField(label="邮箱", validators=[DataRequired("请输入邮箱!"), Email("邮箱格式不正确!")], description="邮箱", render_kw={ "class": "form-control", "placeholder": "请输入邮箱!" }) phone = StringField(label="手机", validators=[ DataRequired("请输入手机号码!"), Regexp("^1[3|4|5|7|8][0-9]{9}$", message="手机号码格式不正确!") ], description="手机", render_kw={ "class": "form-control", "placeholder": "请输入手机号码!" }) face = FileField(label="头像", validators=[DataRequired("请上传头像!")], description="头像", render_kw={"id": "input_face"}) info = TextAreaField(label="简介", validators=[DataRequired("请输入简介!")], description="简介", render_kw={ "class": "form-control", "rows": 10, "autofocus": "" }) submit = SubmitField('保存修改', render_kw={"class": "btn btn-success"})
class ItemDetails(FlaskForm): #selling_options = [("1", "Buy"), ("2", "Auction"), ("3", "Buy/Auction")] name = StringField("", validators=[InputRequired(), Length(max = 75)]) category = SelectField("Categories", choices=CATEGORY_CHOICES) price = IntegerField("$ - Value in AUD", validators=[InputRequired(message="Please enter an appropriate price number.")]) options = RadioField('Label', choices=[('Auction','Auction'),('Buy','Buy'),('Auction/Buy', 'Auction/Buy')], default='Auction') description = TextAreaField("Description", validators=[InputRequired(), Length(max = 5000)]) image1 = FileField("Image File", validators=[FileRequired(), FileAllowed(['png', 'jpg', 'jpeg'], "Please enter an appropriate image file format (Supported: JPG, PNG and JPEG)")]) image2 = FileField("Image File", validators=[FileAllowed(['png', 'jpg', 'jpeg'], "Please enter an appropriate image file format (Supported: JPG, PNG and JPEG)")]) image3 = FileField("Image File", validators=[FileAllowed(['png', 'jpg', 'jpeg'], "Please enter an appropriate image file format (Supported: JPG, PNG and JPEG)")]) image4 = FileField("Image File", validators=[FileAllowed(['png', 'jpg', 'jpeg'], "Please enter an appropriate image file format (Supported: JPG, PNG and JPEG)")]) image5 = FileField("Image File", validators=[FileAllowed(['png', 'jpg', 'jpeg'], "Please enter an appropriate image file format (Supported: JPG, PNG and JPEG)")]) image6 = FileField("Image File", validators=[FileAllowed(['png', 'jpg', 'jpeg'], "Please enter an appropriate image file format (Supported: JPG, PNG and JPEG)")]) post = SubmitField("Post")
class EditProfileForm(FlaskForm): new_phone = StringField(label=u'手机号码', description='新号码', render_kw={ "class": "form-control", "placeholder": "请输入手机号码!" }) new_info = TextAreaField(label=u'简介', description='简介', render_kw={ "class": "form-control", "rows": 10 }) new_name = StringField(label=u'昵称', description='新昵称', render_kw={ "class": "form-control", "placeholder": "新昵称" }) new_icon = FileField(label=u'头像', description='新头像') submit = SubmitField('编辑', render_kw={"class": "btn btn-primary"})
class BlogPostForm(FlaskForm): title = StringField('Title', validators=[InputRequired()]) text = CKEditorField('Body', validators=[InputRequired()]) image = FileField( 'Image', validators=[InputRequired(), FileAllowed(images, 'Images only!')]) categories = QuerySelectMultipleField( 'Categories', validators=[InputRequired()], get_label='name', query_factory=lambda: db.session.query(BlogCategory).order_by('order')) tags = QuerySelectMultipleField( 'Tags', validators=[InputRequired()], get_label='name', query_factory=lambda: db.session.query(BlogTag).order_by('created_at')) newsletter = BooleanField('Send Announcement To Subscribers.') all_users = BooleanField('Send Announcement To All Users.') submit = SubmitField('Submit')
class ActorView(CustomModelView): column_searchable_list = ('first_name', 'last_name', 'hometown') column_filters = ('birthday', 'deathday') form_extra_fields = { "picture": FileField('Picture') } def on_model_change(self, form, model, is_created): path = os.path.abspath( os.path.join( os.path.dirname(__file__), os.pardir ) ) image_path = os.path.join(path, 'static', 'pictures') photo_data = request.files.get(form.picture.name) if photo_data: name = secure_filename(photo_data.filename) model.picture = "/static/pictures/" + name photo_data.save(os.path.join(image_path, name))
class UploadM3uForm(FlaskForm): AVAILABLE_STREAM_TYPES_FOR_UPLOAD = [ (constants.StreamType.PROXY, 'Proxy Stream'), (constants.StreamType.VOD_PROXY, 'Proxy Vod'), (constants.StreamType.RELAY, 'Relay'), (constants.StreamType.ENCODE, 'Encode'), (constants.StreamType.CATCHUP, 'Catchup'), (constants.StreamType.TEST_LIFE, 'Test life'), (constants.StreamType.VOD_RELAY, 'Vod relay'), (constants.StreamType.VOD_ENCODE, 'Vod encode'), (constants.StreamType.COD_RELAY, 'Cod relay'), (constants.StreamType.COD_ENCODE, 'Cod encode') ] file = FileField() type = SelectField(lazy_gettext(u'Type:'), coerce=constants.StreamType.coerce, validators=[InputRequired()], choices=AVAILABLE_STREAM_TYPES_FOR_UPLOAD, default=constants.StreamType.RELAY) submit = SubmitField(lazy_gettext(u'Upload'))