Re: Django Distinct on queryset in forms.py

2010-03-30 Thread Thomas
Dear, Look at my first post i had .distinct() into it and it didn't work out, it's pretty obvious why, he does the distinct on the primary key field (ID) and not on the field hostname, so i get no SELECT Distinct result as i would like to. Trust me the only way of doing this is my 2nd post or the

Re: Django Distinct on queryset in forms.py

2010-03-30 Thread pjrhar...@gmail.com
On Mar 30, 2:10 pm, Thomas wrote: > I already found a solution by myself: > > doing this into the forms.py inside the class does the trick: > >         def __init__(self, *args, **kwargs): >                 super(FilterForm, self) .__init__(*args, **kwargs) >                 self.fields['host'].

Re: Django Distinct on queryset in forms.py

2010-03-30 Thread Thomas
I already found a solution by myself: doing this into the forms.py inside the class does the trick: def __init__(self, *args, **kwargs): super(FilterForm, self) .__init__(*args, **kwargs) self.fields['host'].choices = Test.objects.values_list('hostname', 'h