Does it work for one case at a time? Have you tried

q = request.GET.get('city')
properties = Property.objects.filter(city=q)

I would make sure it is working for each variable before combining
them together. (Maybe you already have, I don't know.)

Alex

On Dec 14, 5:32 pm, Osiaq <osiaq.net...@gmail.com> wrote:
> Andy, I couldn't manage it. Could you (please) give me some example?
> It looks like this case is NOT simple at all, googling through
> multiple websites didn't bring anything even close to  required
> solution.
>
> MODEL:
> class Property(models.Model):
>         name = models.CharField(max_length=200)
>         category =models.ForeignKey(PropertyCategory)
>         city =models.ForeignKey(City)
>         status=models.ForeignKey(PropertyStatus)
>         def __unicode__(self):
>                 return self.name
>
> VIEW:
> def search(request):
> q=request.GET['city']
> c=request.GET['category']
> s=request.GET['status']
> properties = Property.objects.filter( HERE_COMES_WHAT_IM_LOOKING_FOR)
>
> HTML:
> <form action="/search/" method="get">
>         <select name="city">
>         <option value=>ALL</option>
>         <option value="1">Tokyo</option>
>         <option value="2">Nashville</option>
>         </select>
>
>         <select name="category">
>         <option value=>ALL</option>
>         <option value="1">House</option>
>         <option value="2">Apartment</option>
>         </select>
>
>         <select name="status">
>         <option value=>ALL</option>
>         <option value="1">For Sale</option>
>         <option value="2">For Rent</option>
>         </select>
>
>         <input type="submit" value="Search">
> </form>
>
> ...and now I want to display i.e.
> all from Tokyo or
> all Houses or
> all For Sale in Tokyo
> etc...

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


Reply via email to