Sunday, August 8, 2010

Re: Search Field on All Pages

What I do is to setup a search that works at /search/q=search_term, and
then create a form on each page that submits to /search.

<form action="/search/" method="get"><input type="text" name="q"/>
<input type="submit" value="Search"></form>

This form is in my top level site template. The /search/ url is part of
a search application.

There's an example of this working at http://www.brassbandresults.co.uk/

Hope that helps,

Tim.

On 08/08/10 10:41, wchildsuk wrote:
> Hi,
>
> I want a search field on all my pages and was wondering the best way
> to do this. I could create a function and import it to every view but
> this doesn't seem to follow the django DRY principles.
>
> I was wondering if anyone had any advice on how to best do this with
> django?
>
> Thank in advance
>
> Wes
>

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment