title: Loop over fields in a database row in Django template
body: <p>I'm new to Django (1.8, Python 3) and I'm trying to build a little website with it.</p>
  
  <p><em>[for the sake of simplicity, I alter my situation to an imaginary bookstore]</em></p>
  
  <p>What I want to accomplish is the following: imagine I have a model (database table if you will) that includes of a bunch of data of books. I want to show the data to the user. But I'm lazy and I don't want to specify every field in the template. I want a loop that automaticly loops over every field for a specific book and displays <strong>the verbose name</strong> and the data.</p>
  
  <p>What I currently have accomplished, is that I can access the data in my template by having this in my views:</p>
  
  <pre><code>book = Book.objects.get(id=book_id)
  </code></pre>
  
  <p>Where book_id is injected by the url (e.g. site/book/1).
  So, now I can access every field in the template, e.g. {{ book.name }}, or {{ book.author }}. But, it's a lot of manual work to add a html paragraph for every field.</p>
  
  <p>However, I want something like this in my template (just an example, doesn't have to be exactly that):</p>
  
  <pre><code>{% for field in book %}:
      {{ field.verbose_name }} {{ field.data }}
  {% endfor %}
  </code></pre>
  
  <p>But simply doing that with my current current .get(id=book_id) doesn't work. And, I also can't acces the verbose name.</p>
  
  <p>Also, it would be super nice if the solution also works for relationships, for example:</p>
  
  <pre><code>{% for field in book.author %}:
      {{ field.verbose_name }} {{ field.data }}
  {% endfor %}
  </code></pre>
  
  <p>Where it displays all the data of the author table of the currently selected book.</p>
  
  <p>Anyway, I hope my explanation is clear. I'm not really that great in asking clear questions :(</p>
  
  <p>Thanks!</p>