I think you can do it with Middleware.
https://docs.djangoproject.com/en/1.4/topics/http/middleware/#writing-your-own-middleware
Specifically, I think it's worth looking into the
"process_template_response" method.

Tervitades/Regards
Karl Sutt


On Thu, Jun 28, 2012 at 3:11 PM, Bastian <bastien.roche...@gmail.com> wrote:

> Hi,
>
> I don't know if this is possible or how to do it. I would like to write a
> sort of context processor where I pass an object to the template. I have
> always passed strings to these variables. Let's say I have a Book model and
> in a view I list the latest books I've added to the database. In the
> corresponding template I will then have an objects list with these objects.
> But I also want to be able to call a variable containing another list of
> objects, say my favorite books, without having to pass it explicitly from
> the view and being able to call it from any template.
> Can I do it with context processors, or anything else actually?
>
> Thanks.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/sLXf508kb4gJ.
> 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.
>

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