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}} in the template which
returns nothing

I've added the context processor to settings.py and when I run a
pdb.trace() from the context_processor I am able to print the variable
so it is being called + defined.



On Jan 5, 5:22 pm, Nan <ringe...@gmail.com> wrote:
> 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 <nesher....@gmail.com> wrote:
>
>
>
>
>
>
>
> > 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 :
>
> > def index(request):
> >     return render_to_response('front/
> > index.html',context_instance=RequestContext(request)
> >     )
>
> > However when I try to access the variable in my template {{mytest}} it
> > returns empty.
>
> > What am I missing ?

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