Yes but the {{include '...'}} should come after the {{extend '...'}} or inside the extended view. There is no reason to do it before.
Mind that if your goal is to change a sidebar, I suggest you use {{block sidebar}}....{{end}} On Dec 9, 4:53 am, Tito Garrido <titogarr...@gmail.com> wrote: > So, is there any way to reuse a view function? > > Thanks! > > Tito > > > > > > > > > > On Thu, Dec 8, 2011 at 9:47 PM, Anthony <abasta...@gmail.com> wrote: > > I don't think you can put an include before an extend (well, you can, but > > it won't insert the include code before the extended view code, so if your > > call to mysidebar() comes before the {{include}} statement in layout.html, > > this won't work). > > > Anthony > > > On Thursday, December 8, 2011 12:14:04 PM UTC-5, Tito Garrido wrote: > > >> Folks, > > >> I need to change my sidebar sometimes so I've created a view > >> leftsidebar.html with a function like this: > > >> {{def mysidebar():}} > >> my new sidebar!!! > >> {{return}} > > >> And then on may layout.html I've put: > >> {{if 'mysidebar' in globals():}}{{mysidebar()}}{{**else:}} > >> ... > >> {{pass}} > > >> And on a controller view I've tryed: > >> {{include 'leftsidebar.html'}} > >> {{extend 'layout.html'}} > >> ... > > >> This doesn't work... but If I put the content of leftsidebar.html in the > >> controller view it works... > > >> What am I missing here? > > >> Regards, > > >> Tito > > >> -- > > >> Linux User #387870 > >> .........____ > >> .... _/_õ|__| > >> ..º[ .-.___.-._| . . . . > >> .__( o)__( o).:_______ > > -- > > Linux User #387870 > .........____ > .... _/_õ|__| > ..º[ .-.___.-._| . . . . > .__( o)__( o).:_______