Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7067097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:09:36+00:00 2026-05-28T05:09:36+00:00

Here is my view. I am trying to simply display a table with the

  • 0

Here is my view. I am trying to simply display a table with the http meta data.

def display_request_meta_data(request):
    meta_data = request.META.items()
    meta_data.sort()
    for x, y in meta_data:  # output of this loop pasted below
        print x, y
    t = get_template('http_meta_data_table.html')
    html = t.render(Context(meta_data)) # I don't understand how to write this line correctly.
    return HttpResponse(html)

Here is what http_meta_data_table.html looks like:

<html>
<head>
    <title>HTTP Meta Data</title>
</head>
<body>
    <table>
        {% for key, value in meta_data %}
            <tr><td>{{key}}</td><td>{{value}}</td></tr>
        {% endfor %}
    </table>
</body> 
</html>

The loop that prints x, y returns the following (truncated, because there is a bunch of it):

Apple_PubSub_Socket_Render /tmp/launch-SvFjVB/Render
COLORFGBG 7;0
COMMAND_MODE unix2003
CONTENT_LENGTH 
CONTENT_TYPE text/plain
CSRF_COOKIE de982574e125805e307091fcd3f25d2e
DISPLAY /tmp/launch-d6usP9/org.x:0
DJANGO_SETTINGS_MODULE mysite.settings
EDITOR mate -w
GATEWAY_INTERFACE CGI/1.1
HOME /Users/me
etc...
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T05:09:37+00:00Added an answer on May 28, 2026 at 5:09 am

    Context expects a dictionary, mapping keys to values. By calling items(), you got a list of tuples instead:

    [('Apple_PubSub_Socket_Render', '/tmp/launch-SvFjVB/Render'), ...]
    

    Even if you turned this back into a dict (which will lose the ordering), you still cannot use it as a context, because the template doesn’t know a priori what keys are contained in it. Instead, pass meta_data as a value inside the dict:

    html = t.render(Context({'meta_data': meta_data}))
    

    Now saying meta_data in your template will call up the value associated with the key meta_data, which is a list, so your for tag will iterate over that list.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to get the code found here: http://snipplr.com/view/26643/mbprogresshud-with-an-asynchronous-nsurlconnection-call/ to work in my
I'm trying to display a dropdown list of users in my view. Here is
View Here: http://174.132.101.73/~ree/header/ I have a drop down box. I am trying to get
Im trying to add a list view to my activity. Here is what is
I using coda slider in my page. View it here: http://www.ndoherty.com/demos/coda-slider/1.1.1/ Each tab causes
Here's my case: I have a table view showing contacts. Add button in the
I'm trying to use Django to display a table of information from across several
I am playing around with UIAlertView and am trying to simply display an NSLog
By 'view' here I mean different combinations of properties of the model, not the
I am Developing an application which consists of video-view,Here is my problem when I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.