title: Django form in an extended template
body: <p>I am very new to Django, I have a home template (home.html) which is extending a base template (base.html) with <code>{% extends "base.html" %}</code>.</p>
  
  <p><code>base.html</code> containts a contact form.</p>
  
  <pre><code>&lt;form id="email-form" name="email-form" data-name="Email Form" method="post"&gt;
      {% csrf_token %}
      &lt;div&gt;
          &lt;label for="Name-2" class="field-label"&gt;Full name&lt;/label&gt;
          {% render_field form.name class+="text-field w-input" %}
      &lt;/div&gt;
      &lt;div&gt;
          &lt;label for="Email-2" class="field-label"&gt;Email address&lt;/label&gt;
          {% render_field form.from_email class+="text-field _2 w-input" %}
      &lt;/div&gt;
      &lt;div&gt;
          &lt;label for="Phone-2" class="field-label"&gt;Phone number&lt;/label&gt;
          {% render_field form.phone class+="text-field _2 w-input" %}
      &lt;/div&gt;
      &lt;div&gt;
           &lt;label for="Timeline" class="field-label"&gt;More information&lt;/label&gt;
           &lt;div&gt;
               {% render_field form.message class+="text-field area w-input" %}
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="algin-center form-actions"&gt;
          &lt;input type="submit" value="Send Message" data-wait="Please wait..." class="button full w-button"&gt;
      &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p><code>views.py</code></p>
  
  <pre><code>from django.core.mail import send_mail, BadHeaderError
  from django.http import HttpResponse, HttpResponseRedirect
  from django.shortcuts import render, redirect
  from django import forms
  
  class ContactForm(forms.Form):
      name = forms.CharField(required=True)
      from_email = forms.EmailField(required=True)
      phone = forms.CharField(required=True)
      message = forms.CharField(widget=forms.Textarea, required=True)
  
  def homeView(request):
      if request.method == 'GET':
          form = ContactForm()
      else:
          form = ContactForm(request.POST)
          if form.is_valid():
              name = form.cleaned_data['name']
              phone = form.cleaned_data['phone']
              from_email = form.cleaned_data['from_email']
              message = form.cleaned_data['message']
              try:
                  send_mail(name, message, from_email, ['email@email.com'])
              except BadHeaderError:
                  return HttpResponse('Invalid header found.')
              return redirect('success')
      return render(request, "home.html", {'form': form})
  </code></pre>
  
  <p>The form is rendering fine, however, when I click the submit button nothing happens. I'm guessing this is because the form is not in the homeView directly but through extension, but I have no idea how to fix it, is it possible to have the form in an extended view?</p>