On Sat, Mar 7, 2009 at 4:29 PM, luell.m...@gmail.com
<luell.m...@gmail.com>wrote:

>
> What variable?  The search term?
>
> So your search view gets the query and does the actual search, then
> stuffs results and search_term (or something) into the context, and
> passes search_term into the template tag?
>
> Making sure I got it, that does sound better.
>
> Thanks.
>
>
>
> On Mar 7, 4:25 pm, Alex Gaynor <alex.gay...@gmail.com> wrote:
> > On Sat, Mar 7, 2009 at 4:03 PM, luell.m...@gmail.com
> > <luell.m...@gmail.com>wrote:
> >
> >
> >
> >
> >
> >
> >
> > > What's the best way to include a form in every page, such as a search
> > > form in the header?
> >
> > > You could stuff a blank form in with a context processor, and override
> > > that variable in the actual search view so you can fill in the term
> > > that searched for.
> >
> > > Or do people prefer a template tag?  Or something else?
> >
> > > I'm not seeing something that feels truly clean to me so far, probably
> > > missing something.
> >
> > > Thanks.
> >
> > My strategy would be to make a template tag that was passed the variable
> and
> > rendered that if there was data, else created and rendered a blank form.
> >
> > Alex
> >
> > --
> > "I disapprove of what you say, but I will defend to the death your right
> to
> > say it." --Voltaire
> > "The people's good is the highest law."--Cicero
> >
>
Exactly, and because of the way the Django template system works you can
actually always pass the search_form variable to the template tag, even if
iit doesn't exist, and then the template tag can just do a bit of logic to
create the form.

Alex

-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." --Voltaire
"The people's good is the highest law."--Cicero

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