Q:

Django CBV repeating the same query on each page

I am now using Class Based View in my Django application and it helps me a lot to develop faster. 
I still have a question about the best way to implement the following:
I have some information in my database I need to always have in almost every template I have (except the template where user is not logged in). 
What is the good method to make this using Django ?  Is it okay to create a class based view with a custom query in the .get() method? 
Thank you :)

A:

There are various different ways to do this. 
If you are consistently using class-based views everywhere, you could create a common base class with a custom get_context_data method that adds your specific data to the context dictionary. 
But the more usual ways of solving this problem are nothing to do with class-based views, but apply to all sorts of views.  They are custom template tags and context processors. 
For me, a context processor is probably the best bet: as long as you ensure that your template is rendered with RequestContext (which it will be if you use any view that inherits from TemplateView) then your extra data will always be added to the template context.