Я рассмотрел вопросы здесь, и ни один из них, похоже, не помог мне. По существу, я делаю вызов getAllOpenChoices
, чтобы попытаться вернуть значение кнопки «Радио», поэтому при выборе одного из них он сохраняет.«ValueError: требуется больше 0 значений для распаковки»
forms.py
def getAllOpenChoices():
listOpenChoice = [('All', 'All'), ('No One', 'No One'), ('Test','Test')]
all_choices = Requisition.objects.distinct()
for choices in all_choices:
temp = (Requisition.objects.filter(open_to=choices))
listOpenChoice.append(temp)
return tuple(listOpenChoice)
Это ошибка, я получаю:
ValueError: need more than 0 values to unpack
getAllOpenChoices
это называют:
self.fields['open_to'] = forms.ChoiceField(choices = getAllOpenChoices, widget = forms.RadioSelect())
Отлично! Спасибо! –