当我转到下拉列表的set.html
页面时,出现错误builtins.TypeError TypeError: 'int' object is not iterable
form.responsible
сontains以下类型的数据:
[(1534, 'None None (qa@app.com)'), (1535, 'Second Second (qa2@app.com)')]
view.py
current_permission = Permissions.query.all()
users = []
for user in current_permission:
receivers = user.group.users.all()
for user in receivers:
users.append(user)
if is_group_manager or assignee_from_unmanaged_group:
form.responsible.choices = [
(user.id, "{0} ({1})".format(user.details.full_name, user.email))for user in users
set.html
{% block page_block_content %}
<form method="POST">
{{ form.csrf_token }}
{{ wtf.form_field(form.responsible, class="form-control select2") }}
{% endblock %}
form.py
class AssignmentsForm(CSRFForm):
responsible = SelectMultipleField(lazy_gettext("Select assignee"), choices=[])
答案 0 :(得分:0)
我将SelectMultipleField
更改为SelectField
class AssignmentsForm(CSRFForm):
responsible = SelectField(lazy_gettext("Select assignee"), choices=[])