aboutsummaryrefslogtreecommitdiff
path: root/app/blueprints/admin
diff options
context:
space:
mode:
authorrubenwardy <rw@rubenwardy.com>2020-07-17 22:08:34 +0100
committerrubenwardy <rw@rubenwardy.com>2020-07-17 22:08:34 +0100
commit2a7318eca205f40c35c51d3bf7c89dc9f2b635f8 (patch)
tree66538a4511781bc5c2b11df804634a525c4e83b5 /app/blueprints/admin
parentb067fd2e773409790cb86cff1f799ad1563ea480 (diff)
downloadcheatdb-2a7318eca205f40c35c51d3bf7c89dc9f2b635f8.tar.xz
Add descriptions to tags, and show in multiselect
Diffstat (limited to 'app/blueprints/admin')
-rw-r--r--app/blueprints/admin/tagseditor.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/app/blueprints/admin/tagseditor.py b/app/blueprints/admin/tagseditor.py
index 39d69e8..3d351ee 100644
--- a/app/blueprints/admin/tagseditor.py
+++ b/app/blueprints/admin/tagseditor.py
@@ -33,9 +33,10 @@ def tag_list():
return render_template("admin/tags/list.html", tags=Tag.query.order_by(db.asc(Tag.title)).all())
class TagForm(FlaskForm):
- title = StringField("Title", [InputRequired(), Length(3,100)])
- name = StringField("Name", [Optional(), Length(1, 20), Regexp("^[a-z0-9_]", 0, "Lower case letters (a-z), digits (0-9), and underscores (_) only")])
- submit = SubmitField("Save")
+ title = StringField("Title", [InputRequired(), Length(3,100)])
+ description = TextAreaField("Description", [InputRequired(), Length(0, 500)])
+ name = StringField("Name", [Optional(), Length(1, 20), Regexp("^[a-z0-9_]", 0, "Lower case letters (a-z), digits (0-9), and underscores (_) only")])
+ submit = SubmitField("Save")
@bp.route("/tags/new/", methods=["GET", "POST"])
@bp.route("/tags/<name>/edit/", methods=["GET", "POST"])
@@ -54,6 +55,7 @@ def create_edit_tag(name=None):
if request.method == "POST" and form.validate():
if tag is None:
tag = Tag(form.title.data)
+ tag.description = form.description.data
db.session.add(tag)
else:
form.populate_obj(tag)