buku/bukuserver/forms.py

23 lines
756 B
Python
Raw Normal View History

2018-03-27 21:29:58 -05:00
"""Forms module."""
2018-03-30 07:25:28 -05:00
# pylint: disable=too-few-public-methods, missing-docstring
2018-03-27 21:16:54 -05:00
from flask_wtf import FlaskForm
2018-04-03 05:01:03 -05:00
from wtforms import StringField, FieldList, BooleanField, validators, HiddenField
2018-03-27 21:16:54 -05:00
class SearchBookmarksForm(FlaskForm):
keywords = FieldList(StringField('Keywords'), min_entries=1)
all_keywords = BooleanField('Match all keywords')
deep = BooleanField('Deep search')
regex = BooleanField('Regex')
2018-03-30 07:25:28 -05:00
class CreateBookmarksForm(FlaskForm):
url = StringField(validators=[validators.required(), validators.URL(require_tld=False)])
title = StringField()
tags = StringField()
description = StringField()
2018-04-03 05:01:03 -05:00
class EditBookmarksForm(CreateBookmarksForm):
bookmark_id = HiddenField(validators=[validators.required()])