Hi all,
I try to get a list with distinct into the forms.py like this:
forms.ModelMultipleChoiceField(queryset=Events.objects.values('hostname'), required=False).distinct()
In the python shell this command works perfect, but when trying it in forms.py leaves me a blank form, so nothing appears. When i just do Events.objects.all() the form appears, but distinct doesn't work with Events.objects.all()... i also tried values_list etc but doesn't seem to fit into the forms neither... anyone got an idea how to get a SELECT DISTINCT into a ModelMultipleChoiceField?
I read some other questions about this at stackoverflow but nothing seems to work out with me, so hopefully someone knows how to do this in forms.py.
Thxs in advance