title: How to format django generated sitemap lastmod date?
body: <p>My sitemap generated this way:</p>
  
  <pre><code>from django.contrib.sitemaps import Sitemap
  from django.utils import timezone
  
  class StaticViewSitemap(Sitemap):
      priority = 0.5
      changefreq = 'daily'
  
          def items(self):
              return ['index', 'contacts']
  
          def lastmod(self, item):
              return timezone.now()
  </code></pre>
  
  <p>As django docs <a href="https://docs.djangoproject.com/en/1.10/ref/contrib/sitemaps/#django.contrib.sitemaps.Sitemap.lastmod" rel="nofollow">says</a>, lastmod returns datetime. It renders sitemap.xml lastmod to 'yyyy-mm-dd' format and looks so:</p>
  
  <pre><code>&lt;urlset&gt;
      &lt;url&gt;
          &lt;loc&gt;http://127.0.0.1/index&lt;/loc&gt;
         &lt;lastmod&gt;2016-10-19&lt;/lastmod&gt;
         &lt;changefreq&gt;daily&lt;/changefreq&gt;
      &lt;/url&gt;
      &lt;url&gt;
         &lt;loc&gt;http://127.0.0.1/contacts&lt;/loc&gt;
         &lt;lastmod&gt;2016-10-19&lt;/lastmod&gt;
         &lt;changefreq&gt;daily&lt;/changefreq&gt;
      &lt;/url&gt;
  &lt;/urlset&gt;
  </code></pre>
  
  <p>But how could I change lastmod format to ISO8601 (I need this: 2008-01-02T10:30:00+02:00) to get this:</p>
  
  <pre><code>&lt;urlset&gt;
      &lt;url&gt;
          &lt;loc&gt;http://127.0.0.1/index&lt;/loc&gt;
         &lt;lastmod&gt;2016-10-19T00:25:00+03:00&lt;/lastmod&gt;
         &lt;changefreq&gt;daily&lt;/changefreq&gt;
      &lt;/url&gt;
      &lt;url&gt;
         &lt;loc&gt;http://127.0.0.1/contacts&lt;/loc&gt;
         &lt;lastmod&gt;2016-10-19T00:25:00+03:00&lt;/lastmod&gt;
         &lt;changefreq&gt;daily&lt;/changefreq&gt;
      &lt;/url&gt;
  &lt;/urlset&gt;
  </code></pre>
  
  <p>I've played around making custom 'formats' path as said <a href="https://docs.djangoproject.com/en/1.9/topics/i18n/formatting/#creating-custom-format-files" rel="nofollow">here</a> (Django format localization) but did not found which setting should I change to get appropriate date format.
  Thanks.</p>
  
  <p>My urls.py:</p>
  
  <pre><code>...
  
  sitemaps = {
      'static': StaticViewSitemap
  }
  
  urlpatterns = [
      ...
      url(r'^sitemap\.xml$', sitemap, {'sitemaps': sitemaps}, name='django.contrib.sitemaps.views.sitemap'),
      ...
  ]
  </code></pre>