title: Django: How to add another form to my homepage when the homepage already has a template
body: <p>On my homepage(<a href="http://127.0.0.1:8000/" rel="nofollow noreferrer">http://127.0.0.1:8000/</a>) I created a template and its function in views.py and the URL of the homepage directs to it, however, there is a form that I want also to show on the homepage.</p>
  <p>views.py:</p>
  <pre><code>def index(request):
  template = loader.get_template('tracker/index.html')
  hours_grouped_project = 
  LogHours.objects.all().order_by('proj_assignment__project__name', 'day')
  
  context = {
      'hours_grouped_project':hours_grouped_project,
  }
  return HttpResponse(template.render(context,request))
  
  def form(request):
      if request.method== 'POST':
      form = LogHoursForm(request.POST)
      if form.is_valid():
          day = form.cleaned_data['day']
          hours = form.cleaned_data['hours']
          developer = form.cleaned_data['developer']
          project = form.cleaned_data['project']
          proj_assignment=ProjectAssignment.objects.create(
                          developer=developer,project=project)
          LogHours.objects.create(day=day,hours=hours, 
                                  proj_assignment= proj_assignment)
      else:
         form = LogHoursForm()
  
      return render(request, 'tracker/form.html',{'form': form})
  </code></pre>
  <p>the index is for the template displayed on the homepage, and the form is for the form.py.</p>
  <p>form.py</p>
  <pre><code>class LogHoursForm(forms.Form):
  day = forms.DateField()
  hours = forms.DecimalField(max_digits=10, decimal_places=2)
  developer = forms.ModelChoiceField(queryset=Developer.objects.all())
  project = forms.ModelChoiceField(queryset=Project.objects.all())
  </code></pre>
  <p>and here is the URL: urlpatterns = [
  path('', views.index, name='index'),]</p>
  <p>the form.html is</p>
  <pre><code>&lt;h1&gt; LogHours Form&lt;/h1&gt;
  &lt;hr&gt;
  
  &lt;form action=&quot;&quot; method=&quot;post&quot;&gt;
  {% csrf_token %}
  {{form}}
  &lt;input type=&quot;submit&quot;&gt;
  &lt;/form&gt;
  </code></pre>
  <p>and the index.html:</p>
  <pre><code>&lt;ul&gt;
      &lt;b&gt;Logged hours grouped by project:&lt;/b&gt;
  {% for obj in hours_grouped_project %}
  &lt;li&gt;
      {% ifchanged obj.proj_assignment %}
      &lt;b&gt;Project name:&lt;/b&gt;
      {{obj.proj_assignment|linebreaks}}
      {% endifchanged %}
      &lt;i&gt;Sorted Date: &lt;/i&gt;
      {{obj}}
  &lt;/li&gt;
  {% endfor %}
  
  &lt;/ul&gt;
  </code></pre>