Hello everyone, I'm puzzling for some time now to get a solution for my following problem. I hope someone can help me.
I need some context to be filtered before it's rendered in a template. To do this I got the following piece of code saved in catalog_context_processors.py : from catalog.models import Category def filter_active_category(request): return { 'active_categories': Category.objects.filter(is_active=True), 'request': request } To make use of this context processor I need to get the file into TEMPLATE_CONTEXT_PROCESSORS. (right?) When I search the internet almost every hit I get, tells me I have to re-define TEMPLATE_CONTEXT_PROCESSORS in my settings file, copy the contents of this variable from the global settings to my settings and add my file ( catalog_context_processors ). I have a feeling that it is a much better (cleaner) solution if I add the following to my settings.py: TEMPLATE_CONTEXT_PROCESSORS = global_settings.TEMPLATE_CONTEXT_PROCESSORS + ( 'context_processors', ) I have the following questions which I hope somebody can answer: 1. Am I right too use this construction at all? Or is there a better solution to get this done in Django? 2. Are there best practices for this construction? With this I mean; if this is the way too go...Where should the "context_processors.py" live? (Which directory?) Oh....I'm using Django 1.5.1. Many thanks in advance for any pointers in the right direction!! -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.