Re: Passing variables from a context processor to a template

2012-01-06 Thread Guy Nesher
Thanks, Works perfectly now (and yeah I'm fairly new to Python/Django) On Jan 5, 5:44 pm, Rainy wrote: > On Jan 5, 12:38 pm, Rainy wrote: > > > > > > > > > > > On Jan 5, 12:35 pm, Guy Nesher wrote: > > > > Thanks, > > > > I've initially tried to use a dictionary but was still unable to pull >

Re: Passing variables from a context processor to a template

2012-01-05 Thread Rainy
On Jan 5, 12:38 pm, Rainy wrote: > On Jan 5, 12:35 pm, Guy Nesher wrote: > > > Thanks, > > > I've initially tried to use a dictionary but was still unable to pull > > the data in the template. > > > I'm using your updated context processor: > > def swiss_context_processors(request): > >     add

Re: Passing variables from a context processor to a template

2012-01-05 Thread Rainy
On Jan 5, 12:35 pm, Guy Nesher wrote: > Thanks, > > I've initially tried to use a dictionary but was still unable to pull > the data in the template. > > I'm using your updated context processor: > def swiss_context_processors(request): >     added_context = { 'mytest': 'aaa', } >     return add

Re: Passing variables from a context processor to a template

2012-01-05 Thread Guy Nesher
Thanks, I've initially tried to use a dictionary but was still unable to pull the data in the template. I'm using your updated context processor: def swiss_context_processors(request): added_context = { 'mytest': 'aaa', } return added_context and trying to call {{added_context.mytest}} i

Re: Passing variables from a context processor to a template

2012-01-05 Thread Nan
Two things: 1) make sure the context processor is installed in your settings file. 2) context processors should return dicts. Try: def swiss_context_processors(request): added_context = { 'mytest': 'aaa', } return added_context On Jan 5, 12:03 pm, Guy Nesher wrote: > Hi, > > I've crea

Re: Passing variables from a context processor to a template

2012-01-05 Thread Michael Elkins
On Thu, Jan 05, 2012 at 09:03:56AM -0800, Guy Nesher wrote: I've created a simple context processor which simply returns a variable, however I'm unable to retrieve it from my template. "Each context processor must return a dictionary." https://docs.djangoproject.com/en/1.3/ref/templates/api/#w

Passing variables from a context processor to a template

2012-01-05 Thread Guy Nesher
Hi, I've created a simple context processor which simply returns a variable, however I'm unable to retrieve it from my template. The context processor is quite simple : def swiss_context_processors(request): mytest = "aaa" return mytest and I am calling the context processor in my view