> 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.
Personally, I like all of my forms to be classes. If you want that,
you should create a context processor.
http://docs.djangoproject.com/en/dev/ref/templates/api/#writing-your-own-context-processors
Cheers, Roald
--
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