title: How to display Model data in a Django Template
body: <p>I am new to Django. I am trying to display data from my Project model in my index view, using a template. I tried my best to structure this app similar to the polls app. I'm not sure what I am doing wrong. I am using python 2.7, and django 1.8.6</p>
  
  <p>Here is my url:</p>
  
  <pre><code>from django.conf.urls import url
  
  from . import views
  
  app_name = 'project'
  urlpatterns = [
      url(r'^$', views.IndexView.as_view(), name='index'),
      url(r'^(?P&lt;pk&gt;[0-9]+)/$', views.DetailView.as_view(), name='detail'),
  ]
  </code></pre>
  
  <p>Here is my Model:</p>
  
  <pre><code>import datetime
  from django.db import models
  from django.utils.encoding import python_2_unicode_compatible
  from django.contrib.auth.models import User
  from django.utils import timezone
  
  
  @python_2_unicode_compatible  # only if you need to support Python 2
  class Contractor(models.Model):
      #project
      name = models.CharField(max_length=50)
      address = models.CharField(max_length=100, blank=True)
      phone = models.CharField(max_length=14, blank=True)
      city = models.CharField(max_length=60, blank=True)
      state = models.CharField(max_length=2, blank=True)
      created_by = models.ForeignKey(User, related_name='Contractor_created_by')
      created_date = models.DateTimeField()
      modified_by = models.ForeignKey(User, related_name='Contractor_modified_by')
      modified_date = models.DateTimeField()
  
      def __str__(self):
          return self.name
  
  @python_2_unicode_compatible  # only if you need to support Python 2
  class Project(models.Model):
      name = models.CharField(max_length=50)
      jobNumber = models.CharField(max_length=8)
      shopOut = models.DateTimeField(null=True)
      shopIn = models.DateTimeField(null=True)
      delivery = models.DateTimeField(null=True)
      job1 = models.CharField(max_length=50, null=True)
      job2 = models.CharField(max_length=50, null=True)
      job3 = models.CharField(max_length=50, null=True)
      contractor = models.ForeignKey(Contractor, on_delete=models.CASCADE, default=101)
      created_by = models.ForeignKey(User, related_name='Project_created_by')
      created_date = models.DateTimeField(auto_now_add=True)
      modified_by = models.ForeignKey(User, related_name='Project_modified_by')
      modified_date = models.DateTimeField(auto_now=True)
      def __str__(self):
          return self.name
      def save(self, *args, **kwargs):
          if not self.id:
              self.created_by = User.objects.get(id=1)
              self.modified_by = User.objects.get(id=1)
              super(Project, self).save(*args, **kwargs)
              year = datetime.datetime.now().year
              self.jobNumber = '{}{:04d}'.format(year, self.id)
          self.modified_by = User.objects.get(id=1)
          super(Project, self).save(*args, **kwargs)
  </code></pre>
  
  <p>Here is my View:</p>
  
  <pre><code>from django.shortcuts import get_object_or_404, render
  from django.http import HttpResponseRedirect
  from django.core.urlresolvers import reverse
  from django.views import generic
  from django.utils import timezone
  
  from .models import Project
  
  # Create your views here.
  class IndexView(generic.ListView):
      model = Project
      template_name = 'project/index.html'
  
      def get_queryset(self):
          return Project.objects
  
  class DetailView(generic.DetailView):
      model = Project
  </code></pre>
  
  <p>Here is my Template:</p>
  
  <pre><code>{% load staticfiles %}
  &lt;h1&gt;Projects&lt;/h1&gt;
  &lt;ul&gt;
  {% for projects in project.get_queryset %}
      in for loop
      &lt;!-- &lt;li&gt;&lt;a href="{% url 'projects:detail' projects.id %}"&gt;{{ projects.name }}&lt;/a&gt;&lt;/li&gt; --&gt;
      &lt;li&gt;&lt;a href="#"&gt;Test&lt;/a&gt;&lt;/li&gt;
  {% endfor %}
  
  &lt;/ul&gt;
  end of list
  </code></pre>
  
  <p>When I go to the page I get a h1 Project, an empty ul, and a line that says 'end of list'</p>