title: Django print sqlite db data in template
body: <p>I'm new to django and I'm having a little difficulty getting my database data to print onto my page. I'd appreciate help - and I know I'm doing something silly but I've kinda hit the wall.</p>
  
  <p>I have the DB set up and I can access the data in it without any issues:</p>
  
  <p>python manage.py shell</p>
  
  <pre><code>&gt;&gt;&gt; from homepage.models import User, Oncall
  &gt;&gt;&gt; user_data = User.objects.all()
  &gt;&gt;&gt; names = []
  &gt;&gt;&gt; for x in user_data:
  ...  names.append(x.first_name + ' ' + x.last_name)
  &gt;&gt;&gt; names
  [u'Arthur Mencke', u'John Doe']
  </code></pre>
  
  <p>So then in my views.py I have:</p>
  
  <pre><code>from django.http import HttpResponse
  from django.shortcuts import render, get_object_or_404, render_to_response
  from django.utils import timezone
  import datetime
  from homepage.models import User, Oncall
  from django.template import RequestContext, loader
  from django.template import Template, Context
  from django.template.defaulttags import register
  
  def index(request):
          now = timezone.now()
          users = User.objects.all()
          return render(request, 'homepage/index.html')
  
  def getUsers(request):
          users = User.objects.all()
          name_list = []
          for x in users:
                  name_list.append(x.first_name + ' ' + x.last_name)
          return name_list
  </code></pre>
  
  <p>And in my index.html file:</p>
  
  <pre><code>{% if name_list %}
          {% for x in name_list %}
                  {{ name_list.x }}
          {% endfor %}
  {% else %}
          &lt;b&gt;no users&lt;/b&gt;
  {% endif %}
  
  {{name_list|length}}
  </code></pre>
  
  <p>This will always show up in the browser with: </p>
  
  <pre><code>no users 0
  </code></pre>
  
  <p>I've also tried name_list[x] and mucked around with it quite a bit with no luck</p>
  
  <p>Any ideas?</p>
  
  <p>Cheers, Arthur</p>