Reputation: 141
I'm a newer to Python, and I am having a problem with Django's forms:
args="[('job_201404181748_1712666','job_201404181748_1712666')]"
jobid = forms.ChoiceField(choices=args)
This raised ValueError: need more than 1 value to unpack
. If I replace args
with a string, then it works ok:
jobid = forms.ChoiceField(choices=[('job_201404181748_1712666','job_201404181748_1712666')])
I don't know why. Can anyone help?
Upvotes: 1
Views: 5376
Reputation: 6525
You need to remove the quotes
args=[('job_201404181748_1712666','job_201404181748_1712666')]
Upvotes: 1
Reputation: 3080
Try args
without the surrounding quotes. By surrounding it with quotes, you make args
into a string. The ChoiceField expect a list of choices.
in short, make line 33 look like:
args=[('job_201404181748_1712666','job_201404181748_1712666')]
Upvotes: 4