我有以下 django 形式:
class AccountForm(Form):
evalTypes = django_fields.MultipleChoiceField(label="Default Evaluation Forms", widget=django_widgets.SelectMultiple)
def __init__(self, *args, **kwargs):
super(AccountForm, self).__init__(*args, **kwargs)
# GET POSSIBLE LIST OF EVALUATIONS
self.fields["evalTypes"].queryset = CustomForm.objects.filter(author__permissions__name__in=['manager'])
for q in self.fields["evalTypes"].queryset:
print q # THIS PRINTS ALL THE CORRECT VALUES
问题是当页面加载时,唯一出现的是空的选择框。这很奇怪,因为我有明确的证据证明查询集被正确填充。我会错过什么?