Wow, thank you so much Daniel.
I totally get this now, and it works!
Looks like I've sort of been skirting around this solution for a while
but, being clueless as I can be sometimes with Django, I never knew
what I could've been doing wrong.
Thanks a lot for the help again.
-Bob
On Sep 23, 4:
On Sep 23, 4:44 pm, BobZ <[EMAIL PROTECTED]> wrote:
> Thanks Daniel. I've found solutions similar to yours in other threads
> on the net, and everytime I test them, I literally get no form at all
> in my rendered template.
> My template appears to have all the correct code in it as you can see
>
I had SOME luck with "queryset=Vehicle.objects.filter(year=True)" in
that the form actually rendered in my template, but the year select
box is empty now. All other select boxes load fine (Make and Model)
with their data...only year still won't work.
On Sep 23, 10:44 am, BobZ <[EMAIL PROTECTED]>
Thanks Daniel. I've found solutions similar to yours in other threads
on the net, and everytime I test them, I literally get no form at all
in my rendered template.
My template appears to have all the correct code in it as you can see
in the link "search.html" at the bottom of this post.
Looking
On Sep 22, 10:58 pm, BobZ <[EMAIL PROTECTED]> wrote:
> Thanks dmorozov, that worked fine in the sense that it returned only
> unique years in a select box, but it still didn't order them properly
> (getting non-duplicate years as 1961, 1931, 2000, 1975, 1995, etc.).
>
> Somehow the order_by sectio
Thanks dmorozov, that worked fine in the sense that it returned only
unique years in a select box, but it still didn't order them properly
(getting non-duplicate years as 1961, 1931, 2000, 1975, 1995, etc.).
Somehow the order_by section of "set([(obj.year, obj.year) for obj in
Vehicle.objects.al
You can try something like this:
class SearchForm(forms.ModelForm):
year = forms.ChoiceField()
def __init__(self, *args, **kwargs):
super(SearchForm, self) .__init__(*args, **kwargs)
self.fields['year'].choices = \
set([(obj.year, obj.year) for obj in \
You can try something like this:
class SearchForm(forms.ModelForm):
year = forms.ChoiceField()
def __init__(self, *args, **kwargs):
super(SearchForm, self) .__init__(*args, **kwargs)
self.fields['year'].choices = \
set([(obj.year, obj.year) for obj in \
8 matches
Mail list logo