title: Prepopulate Django ModelForm With all records
body: <p>I am trying to prepopulate my form with all records but i am receiving error
  'QuerySet' object has no attribute '_meta' ,
  I tried just passing my queryset through initial while i get no error the fields in my template aren't rendering <code>initial={runninghours}</code></p>
  <p>my views.py:</p>
  <pre><code>def runninghours(request):
      runninghours = RunningHours.objects.all()
      form = RunningHoursModelForm()
      form_populated =  RunningHoursModelForm(initial={runninghours})
      if request.method == 'POST' and 'form-create' in request.POST:
          form = RunningHoursModelForm(request.POST)
          if form.is_valid():
              form.save()
              return redirect(request.path_info)
      context = {&quot;form&quot;: form,
                 &quot;rhs&quot;: form_populated}
      return render(request, 'runninghours.html', context)
  </code></pre>
  <p>The template:</p>
  <pre><code>&lt;form method=&quot;POST&quot; action=&quot;&quot;&gt;
                          {% csrf_token %}
                         &lt;td&gt;{% render_field rhs.name  %}&lt;/td&gt;
                         &lt;td&gt;{% render_field rhs.current_runninghours %}&lt;/td&gt;
                         &lt;td&gt;{% render_field rhs.last_runninghours %}&lt;/td&gt;
                         &lt;td&gt;{% render_field rhs.last_modified %}&lt;/td&gt;
                         &lt;td&gt; &lt;input type=&quot;hidden&quot; name=&quot;update_runninghours_id&quot; value=&quot;{{ rhs.pk }}&quot; /&gt;
                          &lt;input name=&quot;form-delete&quot; type=&quot;submit&quot; class=&quot;button1&quot; value='Update Runninghours' /&gt;&lt;/td&gt;
                      &lt;/form&gt;
  </code></pre>
  <p>the models.py:</p>
  <pre><code>class RunningHours(models.Model):
      name = models.CharField(max_length=100)
      current_runninghours = models.IntegerField(blank=True,null=True)
      last_runninghours = models.IntegerField(blank=True,null=True,default=0)
      last_modified = models.DateField((&quot;Date&quot;), default=datetime.date.today)
  </code></pre>
  <p>forms.py:</p>
  <pre><code>class RunningHoursModelForm(forms.ModelForm):
          model = RunningHours
          fields = (&quot;name&quot;,
                    &quot;current_runninghours&quot;,
                    &quot;last_runninghours&quot;,)
  </code></pre>