Re: ModelForm vs CheckboxSelectMultiple

2008-09-20 Thread Vance Dubberly
Martin, Thank you, that let me delete my extra bunch of code and made me feel silly for even going there. ;) Vance On Sat, Sep 20, 2008 at 4:42 PM, Martin Ostrovsky <[EMAIL PROTECTED]> wrote: > > When creating your widget, you need to set empty_label = None, this > will supress the ''

Re: ModelForm vs CheckboxSelectMultiple

2008-09-20 Thread Martin Ostrovsky
When creating your widget, you need to set empty_label = None, this will supress the '' choice. Also, I think you want to use forms.ModelMultipleChoiceField in conjunction with the widget forms.CheckboxSelectMultiple. On Sep 20, 6:26 pm, "Vance Dubberly" <[EMAIL PROTECTED]> wrote: > End resu

Re: ModelForm vs CheckboxSelectMultiple

2008-09-20 Thread Vance Dubberly
End result is I duplicated the code form the CheckboxSelectMultiple and made my own. Only difference is that I test for for an option value and don't append to the form if there isn't one if option_value: ... output.append(u'%s %s' % (label_for, rendered_cb, option_label)) Vance On Sat

Re: ModelForm vs CheckboxSelectMultiple

2008-09-20 Thread Vance Dubberly
Unfortunately no luck locations = forms.ModelChoiceField(Location.objects.all(), widget=forms.CheckboxSelectMultiple(), initial='') locations = forms.ModelChoiceField(Location.objects.all(), widget=forms.CheckboxSelectMultiple(), initial=None) no impact. Vance On Fri, Sep 19, 2008 at 9:03 PM

Re: ModelForm vs CheckboxSelectMultiple

2008-09-19 Thread Joshua Jonah
... use the 'initial' attribute of the form field. Vance Dubberly wrote: > So with a form that does this: > forms.ModelChoiceField(TransportMethod.objects.all(), > widget=forms.CheckboxSelectMultiple()) > > The first check box has no value and is labeled '-' is there > an option to have

Re: ModelForm vs CheckboxSelectMultiple

2008-09-19 Thread Joshua Jonah
You have to set a default. Vance Dubberly wrote: > So with a form that does this: > forms.ModelChoiceField(TransportMethod.objects.all(), > widget=forms.CheckboxSelectMultiple()) > > The first check box has no value and is labeled '-' is there > an option to have that not exist. I don'

ModelForm vs CheckboxSelectMultiple

2008-09-19 Thread Vance Dubberly
So with a form that does this: forms.ModelChoiceField(TransportMethod.objects.all(), widget=forms.CheckboxSelectMultiple()) The first check box has no value and is labeled '-' is there an option to have that not exist. I don't don't see a passable param which would turn it off in either