Skip to content

Commit

Permalink
use multiSelect for tags
Browse files Browse the repository at this point in the history
  • Loading branch information
SamLR authored and marksteward committed Jan 4, 2024
1 parent e94b74c commit 775b595
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion apps/cfp_review/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,8 @@ def log_and_close(msg, next_page, proposal_id=None):
else:
raise Exception("Unknown cfp type {}".format(prop.type))

form.tags.choices = [(t.tag, t.tag) for t in Tag.query.order_by(Tag.tag).all()]

# Process the POST
if form.validate_on_submit():
try:
Expand Down Expand Up @@ -368,7 +370,7 @@ def log_and_close(msg, next_page, proposal_id=None):
form.state.data = prop.state
form.title.data = prop.title
form.description.data = prop.description
form.tags.data = Tag.serialise_tags(prop.tags)
form.tags.data = [t.tag for t in prop.tags]
form.requirements.data = prop.requirements
form.length.data = prop.length
form.notice_required.data = prop.notice_required
Expand Down
3 changes: 2 additions & 1 deletion apps/cfp_review/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
BooleanField,
IntegerField,
FloatField,
SelectMultipleField,
)
from wtforms.validators import DataRequired, Optional, NumberRange, ValidationError

Expand All @@ -24,7 +25,7 @@ class UpdateProposalForm(Form):
state = SelectField("State", choices=[(s, s) for s in ORDERED_STATES])
title = StringField("Title", [DataRequired()])
description = TextAreaField("Description", [DataRequired()])
tags = StringField("Tags")
tags = SelectMultipleField("Tags")
requirements = TextAreaField("Requirements")
length = StringField("Length")
notice_required = SelectField(
Expand Down
3 changes: 2 additions & 1 deletion models/cfp_tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ def serialise_tags(self, tag_list: list["Tag"]) -> str:
@classmethod
def parse_serialised_tags(cls, tag_str: str) -> list["Tag"]:
res = []
tag_list = [t.strip().lower() for t in tag_str.split(",")]
# tag_list = [t.strip().lower() for t in tag_str.split(",")]
tag_list = [t.strip().lower() for t in tag_str]
for tag_value in tag_list:
if len(tag_value) == 0:
continue
Expand Down
2 changes: 1 addition & 1 deletion templates/cfp_review/update_proposal.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ <h4 class="panel-title">
{{ render_dl_field(form.state) }}
{{ render_dl_field(form.title) }}
{{ render_dl_field(form.description, rows=8) }}
{{ render_dl_field(form.tags) }}
{{ render_dl_field(form.tags, size=5) }}
</dl>
</div>
</div>
Expand Down

0 comments on commit 775b595

Please sign in to comment.