Django sitemap index with paged content

I was working on the sitemap index. I would like every 40000 item group into one sitemap on the site index like this

<sitemapindex xmlns="">

I couldn’t find ways of doing it without using plugin.

Each item on the siteindex require it’s own class, so I created class dynamically using type, and by using paginator

from sitemap import generateSitemaps

sitemaps = generateSitemaps()

urlpatterns += patterns('django.contrib.sitemaps.views',
    url(r'^sitemap\.xml$', 'index', {'sitemaps': sitemaps}),
    url(r'^sitemap-(?P<section>.+)\.xml$', 'sitemap', {'sitemaps': sitemaps}),

from models import Post
from django.core.paginator import Paginator


def items(self):
    posts = Post.objects.filter(deletedByAdmin=False, deletedByUser=False).order_by("-id")
    paginator = Paginator(posts, sitemapEntryPage)

def generateSitemaps():
    siteMaps = { "static" : StaticViewSitemap }
    postPages = range(Post.objects.filter(deletedByAdmin=False, deletedByUser=False).count())[0::sitemapEntryPage]
    for postPage in postPages: 
        page = postPage / sitemapEntryPage + 1
        postPageCls = type('postPage' + str(page), (Sitemap,), {'items': items}) = page
        postPageCls.priority = 0.5
        postPageCls.changefreq = 'daily'
        siteMaps['postPage' + str(page)] = postPageCls

    return siteMaps

If there is a better way please feel free to let me know :)