Question

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?

Was it helpful?

Solution

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')]

OTHER TIPS

You need to remove the quotes

args=[('job_201404181748_1712666','job_201404181748_1712666')]
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top