Re: Variables in parent template

2009-03-20 Thread Alex Gaynor
On Fri, Mar 20, 2009 at 7:20 AM, Antonio  wrote:

>
> Hello.
>
> My site actually uses templates extending a base template "base.html".
> Now I would like to include in each page of the site a search form.
> Obviously I have to work on base template.
>
> The "immediate" solution is writing raw html to display the form. But
> is that the only solution?
>
> I was wondering if I can create e a form object and include it in each
> page. Of course I can't pass it in each view through context. Is there
> a way to get the html of a form object from the base template?
>
> Thank you.
> Antonio
>
> >
>
Take a look at template context processors, they are made for something just
like this.

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



Variables in parent template

2009-03-20 Thread Antonio

Hello.

My site actually uses templates extending a base template "base.html".
Now I would like to include in each page of the site a search form.
Obviously I have to work on base template.

The "immediate" solution is writing raw html to display the form. But
is that the only solution?

I was wondering if I can create e a form object and include it in each
page. Of course I can't pass it in each view through context. Is there
a way to get the html of a form object from the base template?

Thank you.
Antonio

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