2017-04-21 82 views
1

當我去的網頁set.html在下拉列表是,我得到一個錯誤builtins.TypeError TypeError: 'int' object is not iterable的Python:類型錯誤:「詮釋」對象未在SelectMultipleField WTForm可迭代

form.responsible以下類型的сontains數據: [(1534, 'None None ([email protected])'), (1535, 'Second Second ([email protected])')]

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

我改變SelectMultipleFieldSelectField

class AssignmentsForm(CSRFForm): 
    responsible = SelectField(lazy_gettext("Select assignee"), choices=[]) 
相關問題