title: Change <input> Types and Attributes for a Form Used in a CreateView and UpdateView
body: <p>I'm experimenting with a Django 1.4.6 project for tracking sales leads. I want this to be mobile-friendly, so I'm using Twitter Bootstrap (still on version 2.3.2) with <a href="http://django-crispy-forms.rtfd.org/" rel="nofollow">django-crispy-forms</a>. According to <a href="http://baymard.com/labs/touch-keyboard-types" rel="nofollow">this article</a>, the best way to do e-mail fields is <code>&lt;input type="email" autocapitalize="off" autocorrect="off"&gt;</code> and the best way to do date fields is <code>&lt;input type="date"&gt;</code>. None of these attributes are implemented by default with Django and I'm wondering how best to go about implementing them. Here is the relevant code (simplified):</p>
  
  <p><strong>models.py</strong></p>
  
  <pre><code>from django.db import models
  
  
  class Lead(models.Model):
      name = models.CharField(max_length=50)
      email = models.EmailField(blank=True, null=True)
      initial_contact_date = models.DateField()
  
      class Meta:
          ordering = ('name',)
  
      def __unicode__(self):
          return self.name
  </code></pre>
  
  <p><strong>views.py</strong></p>
  
  <pre><code>from django.core.urlresolvers import reverse
  from django.views.generic import CreateView, ListView, UpdateView
  from .models import Lead
  
  
  class LeadAdd(CreateView):
      model = Lead
  
      def get_context_data(self, **kwargs):
          context = super(LeadAdd, self).get_context_data(**kwargs)
          context['title'] = 'Add a Lead'
          return context
  
      def get_success_url(self):
          return reverse('lead_list')
  
  
  class LeadEdit(LeadAdd, UpdateView):
      def get_context_data(self, **kwargs):
          context = super(LeadEdit, self).get_context_data(**kwargs)
          context['title'] = 'Edit a Lead'
          return context
  
  
  class LeadList(ListView):
      model = Lead
  </code></pre>
  
  <p><strong>urls.py</strong></p>
  
  <pre><code>from django.conf.urls import patterns, url
  from .views import *
  
  
  urlpatterns = patterns('',
      url(r'^$', view=LeadList.as_view(), name='lead_list'),
      url(r'^add/$', view=LeadAdd.as_view(), name='lead_add'),
      url(r'^edit/(?P&lt;pk&gt;[\d]+)/$', view=LeadEdit.as_view(), name='lead_edit'),
  )
  </code></pre>
  
  <p><strong>lead_form.html</strong></p>
  
  <pre><code>{% extends 'base.html' %}
  
  {% load crispy_forms_tags %}
  
  {% block content %}
      &lt;div class="page-header"&gt;
          &lt;h1&gt;{{ title }}&lt;/h1&gt;
      &lt;/div&gt;
  
      &lt;form action="." method="post" class="form-horizontal"&gt;
          {% csrf_token %}
  
          {{ form|crispy}}
  
          &lt;div class="form-actions"&gt;
              &lt;button type="submit" class="btn btn-primary"&gt;Submit&lt;/button&gt;
          &lt;/div&gt;
      &lt;/form&gt;
  {% endblock content %}
  </code></pre>