Re: how do I make django search for male or female without needing to specify an age?

2018-01-28 Thread Andy
Why do you make a POST request for displaying a list? Use GET parameters like its done for admin filters. And for building an API that returns JSON Data use DjangoRestFramework and you will just need to define your serializer fields .. the rest is taken care of for you. That code above looks ove

Re: how do I make django search for male or female without needing to specify an age?

2018-01-26 Thread Julio Biason
Hi Eileen, Your problem seems to be the line if form.is_valid() and form.data['gender'] != '-': It seems it will only accept the form if the gender is not "-"; if you change that (say, removing the part after the and), it should solve it. ... although you should have a better

Re: how do I make django search for male or female without needing to specify an age?

2018-01-26 Thread eileen
I should add that this initally loads a list of children without specifying either gender or age On Friday, January 26, 2018 at 12:05:04 PM UTC-5, eil...@themaii.org wrote: > > I have a file: views.py which refers to two main fields on the page: age > and gender > Right now, the search requires

how do I make django search for male or female without needing to specify an age?

2018-01-26 Thread eileen
I have a file: views.py which refers to two main fields on the page: age and gender Right now, the search requires that an age to be chosen whether or not the gender is, and I'd like to make the age optional as well. I.e get all the children. Additionally, I'd like to search for only males or fe