title: What's wrong here? Iterating over a dictionary in Django template
body: <p>I'm trying to iterate over a dictionary of model values in a Django template - I want to list the verbose_name of each model field alongside its value.</p>
  
  <p>Here's what I have in models.py: </p>
  
  <pre><code>class Manors(models.Model):
      structidx = models.IntegerField(primary_key=True, verbose_name="ID")    
      county = models.CharField(max_length=5, null=True, blank=True, verbose_name="County")   
  
      def get_fields(self):
              d = {}
              #d["database"] = "pubs"
              #d["uid"] = "sa"
              for field in Manors._meta.fields:
                  d[field.verbose_name(self)] = field.value_to_string(self)
              return d
  </code></pre>
  
  <p>And in views.py:</p>
  
  <pre><code>    manor_stats = Manors.objects.get(structidx__exact=id)
      return render_to_response('template.html', { 'place' : place, 'manor_stats' : manor_stats }, context_instance = RequestContext(request))
  </code></pre>
  
  <p>And in the template: </p>
  
  <pre><code>&lt;h4&gt;Statistics&lt;/h4&gt;
  &lt;ul&gt;
   {% for key, value in manor_stats.get_fields %}
   &lt;li&gt; {{ key }}: {{ value }} &lt;/li&gt;
  {% endfor %}
  &lt;/ul&gt;
  </code></pre>
  
  <p>But I just get a weird, distorted-looking list like:</p>
  
  <pre><code>u: i
  d: a
  </code></pre>
  
  <p>It doesn't even work if I use hard-coded values in models.py (as shown commented out above).</p>
  
  <p>What's wrong here? Been trying to work this out for hours:(</p>
  
  <p>---------- UPDATED ---------------</p>
  
  <p>Trying with </p>
  
  <pre><code>def get_fields(self):
          d = {}
          for field in Manors._meta.fields:
              d[field.verbose_name(self)] = { "verbose": field.verbose_name(self), "value": field.value_to_string(self) }
          return d
  </code></pre>
  
  <p>and in template:</p>
  
  <pre><code>&lt;h4&gt;Statistics&lt;/h4&gt;
  &lt;ul&gt;
   {% for key, value in manor_stats.get_fields %}
   &lt;li&gt; {{ key }}: {{ value }}&lt;/li&gt;
  {% endfor %}
  &lt;/ul&gt;
  </code></pre>
  
  <p>just produces a blank list....</p>