Karen and Eric - thank you. Yet another door opened for me :) Mike
Karen Tracey wrote: > On Sun, Aug 16, 2009 at 9:33 PM, Mike Dewhirst <mi...@dewhirst.com.au <snip> > > Based on what your template does, you don't seem to really want to > combine a dictionary with the key 'title' and the META dictionary. > Rather you want a dictionary with the key 'title' and the key > 'meta_dict', with the value for the 'meta_dict' key being the META > dictionary: > > def display_meta(request): > dct = {'title':'META items',} > dct['meta_dict'] = request.META > return render_to_response('polls/meta_dict.html', dct) > > Karen > Eric Abrahamsen wrote: > > On Aug 17, 2009, at 9:33 AM, Mike Dewhirst wrote: > 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. > > ---- 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 -~----------~----~----~----~------~----~------~--~---