On Aug 17, 2009, at 9:33 AM, Mike Dewhirst wrote:
> > There's something here I'm not seeing. If anyone can point out the > docco > which refers I would be most grateful ... I'm using py2.6 and Django > from svn head. > > The template below displays the title correctly but claims "No meta > dictionary passed". Since the title is one of the meta_dict key:value > pairs I feel this should not be. Also, when I uncomment the #print > line > below, the entire meta_dict, including 'title': 'META items' prints. > > Thanks for any pointers ... > > Mike > > ---- views.py (excerpt) ------- > def display_meta(request): > dct = {'title':'META items',} > meta_dict = dict(request.META.items()) > meta_dict.update(dct) > #print(meta_dict) > return render_to_response('polls/meta_dict.html', meta_dict) Variables should be passed to the template as a dictionary, so this response line should look like this: return render_to_response('polls/meta_dict.html', {'meta_dict': meta_dict} Then it will be available in your template. My guess is that, since meta_dict is itself a dictionary, you can currently access its contents in your template by directly using its keys as variables. Hope that works, Eric > -------------------------------- > > ---- meta_dict.html ------------ > {% extends "base_polls.html" %} > {% block content_title %}<h1>{{ title }}</h1>{% endblock %} > {% block content %} > {% if meta_dict %} > <table> > {% for key, value in meta_dict.items %} > <tr><td> {{ key }} </td><td>{{ value }}</td></tr> > {% endfor %} > </table> > {% else %} > <p>No meta dictionary passed</p> > {% endif %} > {% endblock %} > --------------------------------- > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---