django-context

Django template context function without running automatically

Sorry or the confusing title! It's actually a lot simpler than it sounds. I've got a function: def get_messages(request): # do something expensive with the request return 'string' I want to be able to call that function from the template, so I've strapped in with a context processor: def context_processor(request): retur...

Unable to get custom context processor to be invoked

I am trying to create a custom context processor which will render a list of menu items for a logged in user. I have done the following:- Within my settings.py I have TEMPLATE_CONTEXT_PROCESSOR = ( 'django.contrib.auth.context_processors.auth', 'mysite.accounts.context_processors.user_menu', ) Under the accounts submodule ...

Is content from AJAX call added to Django context variable

Hi, I am using the JQuery load function to load part of my page. Can I access the variables from that page in the page that loads it. e.g. Page A uses JQuery load function to load B Page B loads and sets a variable in context called pageB_var which holds a django object Page A can then access this variable by doing {{pageB_var}} sinc...

Django web interface to store queries and define context

I'm open to persuasion that this is a bad idea. But if not, here's the general draw: Web interface to maintain data (django.contrib.admin). Web interface to create pages (django.contrib.flatpages) Web interface to create templates (dbtemplates) Where is the web interface to create queries and define context? (contexts?) EDIT Here...

Conditional context processor for authenticated users

I have a context processor returning list of users friends. I'd like it to return the dictionary of friends only if user is logged in, because currently I have clean database without any users and I'm getting error : Exception Type: DoesNotExist at / Exception Value: UserProfile matching query does not exist. Here are two versions I wa...

Django Context Processors: Is it possible to access current context in ContextProcessor ?

Is there a way I can access current context passed by view in custom context processor so I can add missing variable if I want rather than overriding existing variable ? What I'm trying to Achieve: I construct my URL's like this /city_slug/ and I want to check if city variable already exist in context, otherwise I want to add city to...