On Tue, Jun 06, 2006 at 12:46:00PM -0700, Doug Van Horn wrote:
> My current approach to making these objects available to a template is
> to have a 'base_dict(request)' function that returns a dictionary
> containing the common things under well known names (e.g., { 'menu':
> menu, 'cart': cart, 'recent_items': recent_items}).
> 
> For each view which returns a response (not a redirect), I do:
> 
> d = base_dict(request)
> d['item'] = selected_item
> # etc
> return render_to_response('item.html', d)

Sounds more like something to use Middleware and ContextProcessors for
to me. Use the Middleware to add it to the request, then the context
processor to make it accessable in the templates. AIUI all of the
generic views and render_to_response use RequestContext rather than
Request, so you should be fine.

Thanks,
-- 
Brett Parker

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to