Never mind, alraidy fixed it.
Was not aware that the "initial" wanted a dictionary, not a resultset
now doing:
dict = {}
for arr in request.arrondissement.all():
dict[arr.id] = True
form = SearchForm({'arrondissement': dict,})
On 1 apr, 16:14, Sander wrote:
> Hi guys,
>
> Thi
Hi guys,
This might be a very simple question but it's really driving me crazy
for not working.
I'm trying to set the initial selected values of a
ModelMultipleChoiceField like this:
class MyForm(forms.Form):
arrondissement =
forms.ModelMultipleChoiceField(queryset=Arrondissement.objects.all
2 matches
Mail list logo