buku/bukuserver/forms.py
2018-04-06 15:07:34 +08:00

23 lines
756 B
Python

"""Forms module."""
# pylint: disable=too-few-public-methods, missing-docstring
from flask_wtf import FlaskForm
from wtforms import StringField, FieldList, BooleanField, validators, HiddenField
class SearchBookmarksForm(FlaskForm):
keywords = FieldList(StringField('Keywords'), min_entries=1)
all_keywords = BooleanField('Match all keywords')
deep = BooleanField('Deep search')
regex = BooleanField('Regex')
class CreateBookmarksForm(FlaskForm):
url = StringField(validators=[validators.required(), validators.URL(require_tld=False)])
title = StringField()
tags = StringField()
description = StringField()
class EditBookmarksForm(CreateBookmarksForm):
bookmark_id = HiddenField(validators=[validators.required()])