жесть

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
>>> class Test(forms.Form):
... name = forms.ChoiceField(choices={'a':'value1','b':'value2'})
...
>>> data = {'name':'a'}
>>> a = Test(data)
>>> a.is_valid()
---------------------------------------------------------------------------
<type 'exceptions.ValueError'> Traceback (most recent call last)
D:\dev\project\site\trunk\bydesign\<ipython console> in <module>()
C:\Program Files\Python25\lib\site-packages\django\newforms\forms.py in is_valid(self)
C:\Program Files\Python25\lib\site-packages\django\newforms\forms.py in _get_errors(self)
C:\Program Files\Python25\lib\site-packages\django\newforms\forms.py in full_clean(self)
C:\Program Files\Python25\lib\site-packages\django\newforms\fields.py in clean(self, value)
<type 'exceptions.ValueError'>: need more than 1 value to unpack
>>> a.is_valid()
True
>>>