ChoiceField, TypedChoiceField, ModelChoiceField and empty_label

255 views
Skip to first unread message

ristretto.rb

unread,
Jul 2, 2009, 6:56:01 PM7/2/09
to Django users
Hello,

I have stepped through code, and cruised the django docs, forums, and
internet in general looking for how to setup an empty label with
TypedChoiceField (or ChoiceField.) I suspected it would be done
similar to the way it is done with ModelChoiceField.

With ModelChoiceField, we can specify an empty_label. But, with
TypeChoice and Choice you have to put an empty field in our choices
list. And, None doesn't work, it has to be ''.

I have code that is working fine. But, my question is... Is there
any design reason empty_label was not included in the other Choice
fields?

thanks
ristretto

maplye

unread,
Jul 3, 2009, 8:17:11 PM7/3/09
to django...@googlegroups.com
I also agree that

2009/7/3 ristretto.rb <ristre...@gmail.com>:

zweb

unread,
Jul 5, 2009, 3:26:44 PM7/5/09
to Django users
I also agree this is a needed feature.

On Jul 3, 5:17 pm, maplye <map...@gmail.com> wrote:
> I also agree that
>
> 2009/7/3 ristretto.rb <ristretto...@gmail.com>:
>
>
>
> > Hello,
>
> > I have stepped through code, and cruised the django docs, forums, and
> > internet in general looking for how to setup an empty label with
> > TypedChoiceField (or ChoiceField.)  I suspected it would be done
> > similar to the way it is done with ModelChoiceField.
>
> > With ModelChoiceField, we can specify anempty_label.  But, with
> > TypeChoice and Choice you have to put an empty field in our choices
> > list.  And, None doesn't work, it has to be ''.
>
> > I have code that is working fine.  But, my question is...  Is there
> > any design reasonempty_labelwas not included in the other Choice
> > fields?
>
> > thanks
> > ristretto
Reply all
Reply to author
Forward
0 new messages