class ProfileForm(FlaskForm): """ Edit user information. """ nickname = TextField( lazy_gettext("Nickname"), [validators.Required(lazy_gettext("Please enter your nickname."))], ) password = PasswordField(lazy_gettext("Password")) password_conf = PasswordField(lazy_gettext("Password Confirmation")) automatic_crawling = BooleanField(lazy_gettext("Automatic crawling"), default=True) bio = TextAreaField(lazy_gettext("Bio")) webpage = URLField(lazy_gettext("Webpage")) twitter = URLField(lazy_gettext("Twitter")) is_public_profile = BooleanField(lazy_gettext("Public profile"), default=True) submit = SubmitField(lazy_gettext("Save")) def validate(self): validated = super(ProfileForm, self).validate() if self.password.data != self.password_conf.data: message = lazy_gettext("Passwords aren't the same.") self.password.errors.append(message) self.password_conf.errors.append(message) validated = False if self.nickname.data != User.make_valid_nickname(self.nickname.data): self.nickname.errors.append( lazy_gettext( "This nickname has " "invalid characters. Please use letters, numbers, dots and" " underscores only.")) validated = False return validated
class LegalSettingsForm(BaseForm): tos_url = URLField( # "Terms of Service URL", "서비스 약관 URL", # description="External URL to a Terms of Service document hosted elsewhere", description="외부에서 호스트된 서비스 약관 URL을 링크할 수 있습니다.", ) tos_text = TextAreaField( # "Terms of Service", "서비스 약관", # description="Text shown on the Terms of Service page", description="서비스 약관 페이지에 표시되는 텍스트입니다.", ) privacy_url = URLField( # "Privacy Policy URL", "개인정보 보호정책 URL", # description="External URL to a Privacy Policy document hosted elsewhere", description="외부에서 호스트된 개인정보 보호정책 URL을 링크할 수 있습니다.", ) privacy_text = TextAreaField( # "Privacy Policy", "개인정보 보호정책", # description="Text shown on the Privacy Policy page", description="개인정보 보호정책 페이지에 표시되는 텍스트입니다.", ) # submit = SubmitField("Update") submit = SubmitField("적용")
class PluginSettingsForm(IndicoForm): managers = PrincipalListField(_('Managers'), groups=True, description=_('List of users who can manage recording/webcast requests.')) notification_emails = EmailListField(_('Notification email addresses'), description=_('Notifications about recording/webcast requests are sent to ' 'these email addresses (one per line).')) notification_reply_email = StringField(_('E-mail notification "reply" address'), [IndicoEmail()], description=_('Notifications that are sent to event managers will use ' 'this address in their "Reply-To:" fields.')) webcast_audiences = MultipleItemsField(_('Webcast Audiences'), fields=[{'id': 'audience', 'caption': _('Audience'), 'required': True}], unique_field='audience', description=_('List of audiences for non-public webcasts.')) webcast_ping_url = URLField(_('Webcast Ping URL'), description=_("A ping is sent via HTTP GET to this URL whenever a webcast request " "enters/leaves the 'accepted' state.")) webcast_url = URLField(_('Webcast URL'), [DataRequired()], description=_("The URL to watch the webcast for an event. Can contain {event_id} which " "will be replaced with the ID of the event.")) agreement_paper_url = URLField(_('Agreement Paper URL'), description=_("The URL to the agreement that can be printed and signed offline.")) recording_cds_url = URLField(_('CDS URL'), description=_("The URL used when creating recording links. Must contain the {cds_id} " "placeholder.")) room_feature = QuerySelectField(_("Room feature"), [DataRequired()], allow_blank=True, query_factory=lambda: RoomFeature.query, get_label='title', description=_("The feature indicating that a room supports webcast/recording.")) def validate_recording_cds_url(self, field): if field.data and '{cds_id}' not in field.data: raise ValidationError('{cds_id} placeholder is missing')
class VenueForm(Form): name = StringField('name', validators=[DataRequired('Name is required.')]) city = StringField( 'city', validators=[DataRequired('City is required.'), Length(0, 120)]) state = SelectField('state', validators=[DataRequired('State is required.')], choices=State.choices()) address = StringField('address', validators=[Length(0, 120)]) phone = StringField('phone') genres = SelectMultipleField( 'genres', validators=[DataRequired('At least one genre is required.')], choices=Genre.choices()) image_link = URLField('image_link', validators=[ DataRequired('Image link is required.'), URL(message='Image link must be an URL.'), Length(0, 500) ]) website_link = URLField('website_link', validators=[Length(0, 120)]) facebook_link = URLField('facebook_link', validators=[Length(0, 120)]) seeking_talent = BooleanField('seeking_talent', default='checked') seeking_description = StringField('seeking_description', default='We are looking for talent.')
class Client1Form(BaseForm): name = StringField(validators=[DataRequired()]) website = URLField() default_redirect_uri = URLField() def update(self, client): client.name = self.name.data client.website = self.website.data client.default_redirect_uri = self.default_redirect_uri.data with db.auto_commit(): db.session.add(client) return client def save(self, user): name = self.name.data client_id = gen_salt(48) client_secret = gen_salt(78) client = OAuth1Client( user_id=user.id, client_id=client_id, client_secret=client_secret, name=name, default_redirect_uri=self.default_redirect_uri.data, website=self.website.data, ) with db.auto_commit(): db.session.add(client) return client
class ProjectForm(FlaskForm): id = HiddenField('id') # is_autoupdate = BooleanField(u'Sync project data') name = StringField(u'Title', [length(max=80), UniqueValidator(Project, 'name'), DataRequired()], description="[Required] a short project name, max 80 characters") summary = StringField(u'Summary', [length(max=120)], description="Max 120 characters") longtext = TextAreaField(u'Pitch', description="To format, use Markdown or HTML. Links on their own line get previews for supported providers.") webpage_url = URLField(u'Project link', [length(max=2048)], description="URL to a live demo, presentation, or link to further information") is_webembed = BooleanField(u'Embed project link') autotext_url = URLField(u'Sync', [length(max=255)], description="URL to external source of documentation in GitLab, GitHub, Bitbucket, Data Package or Web site") source_url = URLField(u'Source link', [length(max=255)], description="URL of your repository") contact_url = URLField(u'Contact link', [length(max=255)], description="URL of an issues page, forum thread, chat channel, contact form, social media account, etc.") # Note: relative links allowed in image_url -> StringField image_url = StringField(u'Image link', [length(max=255)], description="URL of an image to display at the top") logo_color = StringField(u'Custom color', [length(max=7)], description="Background color of your project page") # logo_icon = StringField(u'<a target="_blank" href="http://fontawesome.io/icons/#search">Custom icon</a>', # [length(max=20)], description="A FontAwesome icon for the project browser.") category_id = SelectField(u'Challenge category', coerce=int) submit = SubmitField(u'Save changes')
class NewEventForm(FlaskForm): next = HiddenField() id = HiddenField('id') name = StringField( u'Title', [length(max=80), UniqueValidator(Event, 'name'), DataRequired()]) starts_date = DateField(u'Starts date', default=datetime.now()) starts_time = TimeField(u'Starts time', default=time(9, 0, 0)) ends_date = DateField(u'Finish date', default=datetime.now()) ends_time = TimeField(u'Finish time', default=time(16, 0, 0)) summary = StringField( u'Summary', [length(max=140)], description=u'A short overview (140 chars) of the upcoming event') hostname = StringField( u'Hosted by', [length(max=80)], description=u'Organization responsible for the event') location = StringField(u'Located at', [length(max=255)], description=u'The event locale or virtual space') description = TextAreaField(u'Description', description=u'Markdown and HTML supported') logo_url = URLField( u'Host logo link', [length(max=255)], description=u'Link to a logo file, ideally square, max res 512x512') webpage_url = URLField( u'Home page link', [length(max=255)], description=u'Link to register and get information about the event') community_url = URLField( u'Community link', [length(max=255)], description=u'Link to connect to a community forum or hashtag') submit = SubmitField(u'Save')
class NewPostForm(Form): id = HiddenField() title = TextField('Title', validators=[Length(min=3, max=500)]) text = TextAreaField('Text', validators=[Required(), ]) url = URLField('URL') image_url = URLField('Image URL') publish_date = DateTimeField("Publish at date", default=datetime.datetime.now())
class CommercialSignUpForm(UserSignUpForm): """Sign up form for commercial users.""" org_name = StringField("Organization name", validators=[ DataRequired("You need to specify the name of your organization.") ]) org_desc = TextAreaField("Organization description", validators=[ DataRequired("You need to provide description of your organization."), ]) website_url = URLField("Website URL", validators=[ DataRequired("You need to specify website of the organization."), ]) logo_url = URLField("Logo image URL") api_url = URLField("API URL") address_street = StringField("Street", validators=[ DataRequired("You need to specify street.") ]) address_city = StringField("City", validators=[ DataRequired("You need to specify city.") ]) address_state = StringField("State / Province", validators=[ DataRequired("You need to specify state/province.") ]) address_postcode = StringField("Postcode", validators=[ DataRequired("You need to specify postcode.") ]) address_country = StringField("Country", validators=[ DataRequired("You need to specify country.") ]) amount_pledged = DecimalField()
class ProjectForm(FlaskForm): next = HiddenField() id = HiddenField('id') user_id = SelectField(u'Owner (team user)', coerce=int) event_id = SelectField(u'Event', coerce=int) category_id = SelectField(u'Challenge category', coerce=int) progress = SelectField(u'Progress', coerce=int, choices=projectProgressList()) hashtag = StringField(u'Hashtag or channel', [length(max=255)]) autotext_url = URLField(u'Sync', [length(max=255)]) # is_autoupdate = BooleanField(u'Autoupdate project data') name = StringField( u'Title', [length(max=80), UniqueValidator(Project, 'name'), DataRequired()]) summary = StringField(u'Short summary', [length(max=120)]) longtext = TextAreaField(u'Description') autotext = TextAreaField(u'Readme content') webpage_url = URLField(u'Presentation or demo link', [length(max=2048)]) is_webembed = BooleanField(u'Embed contents of demo link in a frame', default=False) source_url = URLField(u'Source link', [length(max=255)]) contact_url = URLField(u'Contact link', [length(max=255)]) image_url = URLField(u'Image link', [length(max=255)]) logo_color = StringField(u'Custom color', [length(max=7)]) logo_icon = StringField(u'Custom icon', [length(max=20)]) # is_template = BooleanField(u'This project is used as a template for the event', default=False) submit = SubmitField(u'Save')
class ArtistForm(Form): name = StringField('name', validators=[DataRequired('Name is required.')]) city = StringField( 'city', validators=[DataRequired('City is required.'), Length(0, 120)]) state = SelectField('state', validators=[DataRequired('State is required.')], choices=State.choices()) phone = StringField('phone') genres = SelectMultipleField( 'genres', validators=[DataRequired('At least one genre is required.')], choices=Genre.choices()) image_link = URLField('image_link', validators=[ DataRequired('Image link is required.'), URL(message='Image link must be an URL.'), Length(0, 500) ]) website_link = URLField('website_link', validators=[Length(0, 120)]) facebook_link = URLField('facebook_link', validators=[Length(0, 120)]) albums = StringField('albums', validators=[Length(0, 500)]) seeking_venue = BooleanField('seeking_venue', default='checked') seeking_description = StringField('seeking_description', default="I'm looking for venues.") available_times = BooleanField('available_times') available_start = DateTimeLocalField('available_start', default=datetime.utcnow, format='%Y-%m-%dT%H:%M') available_end = DateTimeLocalField('available_end', default=datetime.utcnow, format='%Y-%m-%dT%H:%M')
class PluginSettingsForm(IndicoForm): managers = PrincipalListField(_('Managers'), groups=True, description=_('List of users who can manage recording/webcast requests.')) notification_emails = EmailListField(_('Notification email addresses'), description=_('Notifications about recording/webcast requests are sent to ' 'these email addresses (one per line).')) webcast_audiences = MultipleItemsField(_('Webcast Audiences'), fields=[{'id': 'audience', 'caption': _('Audience'), 'required': True}], unique_field='audience', description=_('List of audiences for non-public webcasts.')) webcast_ping_url = URLField(_('Webcast Ping URL'), description=_("A ping is sent via HTTP GET to this URL whenever a webcast request " "enters/leaves the 'accepted' state.")) webcast_url = URLField(_('Webcast URL'), [DataRequired()], description=_("The URL to watch the webcast for an event. Can contain {event_id} which " "will be replaced with the ID of the event.")) agreement_paper_url = URLField(_('Agreement Paper URL'), description=_("The URL to the agreement that can be printed and signed offline.")) recording_cds_url = URLField(_('CDS URL'), description=_("The URL used when creating recording links. Must contain the {cds_id} " "placeholder.")) def validate_recording_cds_url(self, field): if field.data and '{cds_id}' not in field.data: raise ValidationError('{cds_id} placeholder is missing')
class ProjectDetailForm(FlaskForm): id = HiddenField('id') autotext_url = URLField(u'Readme', [length(max=255)], description="URL to external documentation " + "(code repository, online doc,..)") source_url = URLField( u'Sources', [length(max=255)], description="URL of your source code repository or project data.") download_url = URLField( u'Download', [length(max=255)], description="URL to a release page, website, app store,.. " + " where your project may be installed.") contact_url = StringField( u'Contact us', [length(max=255)], description="URL of an issues page, contact form, chat channel, " + "forum thread, social media account,..") # Note: relative links allowed in image_url -> StringField image_url = StringField( u'Cover image', [length(max=255)], description="URL of an image to display at the top of the page.") logo_color = StringField( u'Color scheme', [length(max=7)], description="Customize the color of your project page.") # logo_icon = StringField(u'<a target="_blank" href=" # http://fontawesome.io/icons/#search">Custom icon</a>', # [length(max=20)], description="A FontAwesome icon") submit = SubmitField(u'Save changes')
class New_Material_Form(FlaskForm): series = QuerySelectField("Series", query_factory=lambda: Series.query.all(), validators=[DataRequired()]) note_url = URLField("Note URL", validators=[url()]) slides_url = URLField("Slides URL", validators=[url()]) submit = SubmitField("New")
class DownloadForm(FlaskForm): url = URLField('URL', validators=[DataRequired(), URL()]) outputDir = URLField('Output Directory') authenticate = BooleanField('Authenticate?') provider = SelectField('Provider', choices=[('Comcast/Xfinity', 'Comcast/Xfinity')]) username = StringField('Username', validators=[Email()]) password = PasswordField('Password')
class CafeForm(FlaskForm): """Form for adding new cafes.""" name = StringField("Cafe Name:", validators=[InputRequired()]) description = TextAreaField("Description:", validators=[Optional()]) url = URLField("Cafe url:", validators=[Optional()]) address = StringField("Address:", validators=[InputRequired()]) city_code = SelectField('City:', coerce=str, validators=[InputRequired()]) image_url = URLField("Image url:", validators=[Optional()])
class WishForm(Form): title = TextField('Title', validators=[Required()]) # add per user validation description = TextAreaField('Description', validators=[Required() ]) # add per user validation url = URLField('URL', validators=[URL(), dup]) # add per user validation thumbnail = URLField('Thumbnail', validators=[URL()]) add = SubmitField('Add to Wishlist')
class ModuleForm(FlaskForm): module_rank = IntegerField('โมดูลลำดับที่: ', validators=[DataRequired()]) name = StringField('ชื่อโมดูล: ', validators=[DataRequired()]) vdo_url = URLField('URL ของ Youtube VDO: ') description = PageDownField('เนื้อหาโมดูล: ', validators=[DataRequired()]) file_url = URLField('URL ของไฟล์เอกสารประกอบ: ') pass_condition = DecimalField('เกณฑ์การสอบผ่านโมดูล (0 = 0%, 0.5 = 50%, 1 = 100%): ', places=2, validators=[DataRequired()]) submit = SubmitField('สร้างโมดูล') submit_edit = SubmitField('แก้ไขโมดูล')
class EditUserForm(UserBaseForm): """Edit User Form.""" avatar_url = URLField("Avatar Image URL", validators=[Length(min=6, max=255), Optional()], description="Online image address") banner_url = URLField("Banner Image URL", validators=[Length(min=6, max=255), Optional()], description="Online image address") byline = StringField( "User Byline", validators=[Length(min=2, max=200), Optional()], description="A short snippet shown under your username") bio = TextAreaField("User Bio", validators=[Length(min=2, max=500), Optional()], description="500 character max") city = StringField("City", validators=[Length(min=2, max=50), Optional()]) state = StringField("State", validators=[Length(min=2, max=50), Optional()]) country = StringField("Country", validators=[Length(min=2, max=50), Optional()]) def validate_email(form, field): """Make sure email is not in use unless it's the current user's email.""" user = User.query.filter_by(email=form.email.data).first() if user and not user == g.user: form.email.errors = [ "Email already associated with account!", *form.email.errors ] raise ValidationError def validate_username(form, field): """Make sure username is not in use unless it's the current user's username.""" user = User.query.filter_by(username=form.username.data).first() if user and not user == g.user: form.username.errors = [ "Username already taken!", *form.username.errors ] raise ValidationError
class Client2Form(BaseForm): name = StringField(validators=[DataRequired()]) website = URLField() is_confidential = BooleanField('Confidential Client') redirect_uris = TextAreaField() default_redirect_uri = URLField() allowed_scopes = SelectMultipleField(choices=SCOPES) allowed_grants = SelectMultipleField(choices=GRANTS) def update(self, client): client.name = self.name.data client.website = self.website.data client.is_confidential = self.is_confidential.data client.redirect_uris = self.redirect_uris.data.splitlines() client.token_endpoint_auth_method = 'none' # client.default_redirect_uri = self.default_redirect_uri.data print(self.redirect_uris.data) print( 'WAT : REDIRECT_URIS - update : %s' % client.redirect_uris) client.allowed_scopes = ' '.join(self.allowed_scopes.data) client.allowed_grants = ' '.join(self.allowed_grants.data) with db.auto_commit(): db.session.add(client) return client def save(self, user): name = self.name.data is_confidential = self.is_confidential.data client_id = gen_salt(48) if is_confidential: client_secret = gen_salt(78) else: client_secret = '' print( 'WAT : REDIRECT_URIS - save : %s' % self.redirect_uris.data) client = OAuth2Client( user_id=user.id, client_id=client_id, client_secret=client_secret, name=name, is_confidential=is_confidential, default_redirect_uri=self.default_redirect_uri.data, website=self.website.data, allowed_scopes=' '.join(self.allowed_scopes.data), allowed_grants=' '.join(self.allowed_grants.data), ) client.redirect_uris = self.redirect_uris.data.splitlines() client.token_endpoint_auth_method = 'none' with db.auto_commit(): db.session.add(client) return client
class UploadForm(FlaskForm): url = URLField("Do not enter anything...") subject = SelectField(choices=[('Tutorial', 'Tutorial'), ('Information', 'Information')]) title = TextAreaField("Title of Video") vlink = URLField("Video link (YouTube, Vimeo, Loom, Facebook, etc") # File must mp4 # video = FileField("Video") body = TextAreaField("Description and/or in-depth game plan") submit = SubmitField("Submit")
class LegalMessagesForm(IndicoForm): network_protected_disclaimer = TextAreaField(_("Network-protected information disclaimer"), widget=CKEditorWidget()) restricted_disclaimer = TextAreaField(_("Restricted information disclaimer"), widget=CKEditorWidget()) tos_url = URLField(_('URL'), [URL()], description=_("The URL to an external page with terms and conditions")) tos = TextAreaField(_("Text"), widget=CKEditorWidget(), description=_('Only used if no URL is provided')) privacy_policy_url = URLField(_('URL'), [URL()], description=_("The URL to an external page with the privacy policy")) privacy_policy = TextAreaField(_("Text"), widget=CKEditorWidget(), description=_('Only used if no URL is provided'))
class Client2Form(BaseForm): name = StringField(validators=[DataRequired()]) website = URLField() is_confidential = BooleanField('Confidential Client') redirect_uris = TextAreaField() default_redirect_uri = URLField() allowed_scopes = SelectMultipleField(choices=SCOPES) allowed_grants = SelectMultipleField(choices=GRANTS) def update(self, client): client.name = self.name.data client.website = self.website.data client.is_confidential = self.is_confidential.data client.redirect_uris = self.redirect_uris.data client.default_redirect_uri = self.default_redirect_uri.data client.allowed_scopes = ' '.join(self.allowed_scopes.data) client.allowed_grants = ' '.join(self.allowed_grants.data) with db.auto_commit(): db.session.add(client) return client def save(self, user): name = self.name.data is_confidential = self.is_confidential.data client_id = gen_salt(48) if is_confidential: client_secret = gen_salt(78) else: client_secret = '' client = OAuth2Client( user_id=user.id, client_id=client_id, client_secret=client_secret, name=name, is_confidential=is_confidential, default_redirect_uri=self.default_redirect_uri.data, website=self.website.data, allowed_scopes=' '.join(self.allowed_scopes.data), allowed_grants=' '.join(self.allowed_grants.data), ) try: db.session.add(user) db.session.commit() except: db.session.rollback() raise return client
class ProjectForm(FlaskForm): title = StringField('Title', validators=[Required()]) tags = StringField('Tags') summary = StringField('Summary', widget=TextArea(), validators=[Required()]) description = StringField('Description', widget=TextArea()) uri = URLField('Home URL', validators=[Required(), URL()]) image = FileField('image', validators=[ # FileRequired(), FileAllowed(['jpg', 'png'], 'Images only!') ]) github_repo = URLField('Github repository URL', validators=[Optional(), URL()]) youtube_trailer = URLField('Youtube trailer URL', validators=[Optional(), URL()]) patreon = URLField('Patreon URL', validators=[Optional(), URL()])
class ILLRequestSourceForm(FlaskForm): """Form for source about an ILL Request.""" class Meta: """Meta class for ILLRequestSourceForm.""" csrf = False origin = StringField( description=_('Library catalog name') ) url = URLField( description=_('Link of the document'), render_kw={'placeholder': 'https://...'} ) def validate(self): """Custom validation for this form.""" if self.url.data: self.origin.validators = [ validators.DataRequired() ] if self.origin.data: self.url.validators = [ validators.DataRequired(), validators.URL() ] return super().validate()
class BookmarkForm(FlaskForm): url = URLField('Please enter a URL', validators=[DataRequired(), url()]) description = StringField('Add an optional description') tags = StringField('Tags', validators=[Regexp(r'^[a-zA-Z0-9, ]*$', message="Tags can only contain letters and numbers")]) # Override the validate method to add some custom validation not included with WTForms. def validate(self): # TODO: Improve UX in validating when user doesn't enter a protocol. Fix reappending of incorrect URL form data. # if not self.url.data.startswith("http://") or self.url.data.startswith("https://"): # self.url.data = "https://" + self.url.data # if not FlaskForm.validate(self): # return False if not self.description.data: self.description.data = self.url.data # filter out empty and duplicate tag names # Split the input data at every comma, then remove all whitespace. stripped = [t.strip() for t in self.tags.data.split(',')] # Then remove all empty strings from the list. not_empty = [tag for tag in stripped if tag] # Put everything that remains in a set which removes all duplicates. tagset = set(not_empty) # Put the list of non-empty and non-duplicate tags into a comma separated string again. self.tags.data = ",".join(tagset) return True
class BoolmarkForm(FlaskForm): url = URLField('The URL for your bookmark', validators=[DataRequired(), url()]) description = StringField('Add an optional description') tags = StringField( 'Tags', validators=[ Regexp(r'^[a-zA-Z0-9, ]*$', message="Tags can contain only letters and numbers") ]) def validate(self): if not self.url.data.startswith( "http://") and not self.url.data.startswith("https://"): self.url.data = "https://" + self.url.data # print(self.url.data) # sys.stdout.flush() if not FlaskForm.validate(self): return False if not self.description.data: self.description.data = self.url.data stripped = [t.strip() for t in self.tags.data.split(',')] not_empty = [tag for tag in stripped if tag] tagset = set(not_empty) self.tags.data = ",".join(tagset) return True
class ReferenceTypeForm(IndicoForm): name = StringField(_("Name"), [DataRequired()], description=_("The name of the external ID type")) url_template = URLField( _("URL template"), description=_( "The URL template must contain the '{value}' placeholder.")) scheme = StringField( _("Scheme"), filters=[lambda x: x.rstrip(':') if x else x], description=_("The scheme/protocol of the external ID type")) def __init__(self, *args, **kwargs): self.reference_type = kwargs.pop('reference_type', None) super(ReferenceTypeForm, self).__init__(*args, **kwargs) def validate_name(self, field): query = ReferenceType.find( db.func.lower(ReferenceType.name) == field.data.lower()) if self.reference_type: query = query.filter(ReferenceType.id != self.reference_type.id) if query.count(): raise ValidationError(_("This name is already in use.")) def validate_url_template(self, field): if field.data and '{value}' not in field.data: raise ValidationError( _("The URL template must contain the placeholder '{value}'."))
class ArticleForm(FlaskForm): """ Form for articles """ title = StringField( 'Titulo do artigo:', validators=[DataRequired('Digite o título do artigo.')]) subtitle = StringField('Subtitulo do artigo(se houver):') authors = StringField( 'Nome do autor(es):', validators=[DataRequired('Digite o nome dos autor(es)')]) edition = IntegerField( 'Número da edição:', validators=[DataRequired('Digite o número da edição')]) pages = StringField( 'Número das páginas:', validators=[DataRequired('Digite o número das páginas')]) number = IntegerField('Número:') location = StringField('Local de impressão:') publisher = StringField('Editora:') date = StringField('Data:') link = URLField('Link para a revista(Se existir)') index = IntegerField() create = SubmitField('Adicionar')
class BookForm(FlaskForm): """ Form for books """ title = StringField('Titulo do livro:', validators=[DataRequired('Digite o título do livro.')]) subtitle = StringField('Subtitulo do livro(se houver):') authors = StringField( 'Nome do autor(es):', validators=[DataRequired('Digite o nome dos autor(es)')]) edition = IntegerField( 'Número da edição:', validators=[DataRequired('Digite o número da edição')]) location = StringField('Local de impressão:') publisher = StringField('Editora:') year = IntegerField('Ano da publicação:') link = URLField('Link para a revista(Se existir)') index = IntegerField() create = SubmitField('Adicionar')