What about creating a template_tag for the form? Is that a good way to add
it to several templates?

2010/8/8 Roald de Vries <downa...@gmail.com>

> On Aug 8, 2010, at 2:04 PM, Tim Sawyer wrote:
>
>> 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-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
André Santos Teixeira de Carvalho
Undergraduating in Computer Science DCC/UFRJ

-- 
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