Re: Calling a method from the base template

2008-01-07 Thread Malcolm Tredinnick
On Mon, 2008-01-07 at 20:28 -0600, Michael Hipp wrote: [...] > Is it really necessary to complicate every 'view' method by appending > 'context_instance=RequestContext(request)' to the render_to_response > call? This seems totally boilerplate and a violation of DRY. Write your own shortcut fun

Re: Calling a method from the base template

2008-01-07 Thread Michael Hipp
Peter Rowell wrote: >> There is a mechanism available >> for that -- context processors -- but people don't want to use it >> because they want *something else* that happens for every template. > > Malcolm's absolutely correct: context processors (I mis-typed when I > said content processors) is

Re: Calling a method from the base template

2008-01-06 Thread Peter Rowell
> There is a mechanism available > for that -- context processors -- but people don't want to use it > because they want *something else* that happens for every template. Malcolm's absolutely correct: context processors (I mis-typed when I said content processors) is exactly what you want here. T

Re: Calling a method from the base template

2008-01-06 Thread Kenneth Gonsalves
On 06-Jan-08, at 11:01 PM, Michael Hipp wrote: > Attempting to do a method call {% views.get_stuff %} just results > in a 'bad > tag' error. > > Doing it like a variable {{ views.get_stuff }} just seems to be > ignored. make a templatetag -- regards kg http://lawgon.livejournal.com http:

Re: Calling a method from the base template

2008-01-06 Thread Malcolm Tredinnick
On Sun, 2008-01-06 at 16:12 -0600, Michael Hipp wrote: > Peter Rowell wrote: [...] > > I recommend rethinking how data is passed into and used in your > > templates. Consider creating your own content processor. Or maybe some > > custom template tags and/or filters. See > > http://www.djangoproj

Re: Calling a method from the base template

2008-01-06 Thread Michael Hipp
Peter Rowell wrote: > It > would probably be better (for any number of reasons) if you put all of > these types of routines in a utils.py module and import/pass that. > E.g. > > import utils > return render_to_response('now.html', RequestContext(request, { > 'utils': utils, >

Re: Calling a method from the base template

2008-01-06 Thread Peter Rowell
> Attempting to do a method call {% views.get_stuff %} just results in a 'bad > tag' error. Right, because there is no tag with the name 'views.get_stuff'. > Doing it like a variable {{ views.get_stuff }} just seems to be ignored. Not ignored, but it probably fails which the template engine tre