Solved: ModelChoiceField(empty_label=None)
On Feb 23, 9:14 pm, Brandon Taylor wrote:
> Hi everyone,
>
> What's the trick to getting a ModelChoiceField to use the first object
> in a QuerySet as the initial value to get rid of -?
>
> If I do:
> qs =
Hi everyone,
What's the trick to getting a ModelChoiceField to use the first object
in a QuerySet as the initial value to get rid of -?
If I do:
qs = Model.objects.all()
my_field = forms.ModelChoiceField(queryset=qs, initial=qs[0])
I still get -- as the first choice.
TIA,
2 matches
Mail list logo