2009/4/21 Tim Chase <django.us...@tim.thechases.com>:
> Your urls.py should just have "^/search/$" as the URL.  The
> resulting view function should then make use of the request.GET
> dictionary'ish object:
>
>   def search_view(request):
>     terms = [
>       term.strip()
>       for term in request.GET.get("q", "").split()
>       if term.strip()
>       ]
>     if terms:
>       return render_search_results(request, terms)
>     else:
>       return no_search_string_passed(request)
>
> -tim
>
>

We do this, but without the /search/ part. The site we are building
uses search as a filter, so any listing page can have ?q=foo added to
perform a search within the list. As an added bonus, by using a query
parameter it makes it possible to track search usage in Google
Analytics without hacking around.

Regards,
Andrew Ingram

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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