Hello to all Django users :-)
I'm new to Django and this is my first post.
I'd like to implement breadcrumbs on all my pages.
My strategy is to create a middleware and to use RequestContext to
add a dict to the context of each request then use the context in my html
My problem is that I don't understand how to link RequestContext to
my request. Hereafter my code :
my_middleware.py
from django.template import RequestContext
class SimpleBreadcrumbs(object):
def __init__(self, get_response):
self.get_response = get_response
# One-time configuration and initialization.
def __call__(self, request):
# Code to be executed for each request before
# the view (and later middleware) are called.
request_context = RequestContext(request)
request_context.push({"level0": "Adrian", "level1": "Thomas"})
response = self.get_response(request)
# Code to be executed for each request/response after
# the view is called.
return response
my_template.html
{% extends 'pricing/body.html' %}
{% block content %}
{{ level0 }}
{% endblock content %}
What I'm doing wrong ?
Thx for your help
Micka
Django newbie
;-)