Django sitemap: 'module' object has no attribute 'values'

I follow the description on the http://docs.djangoproject.com/en/1.2/ref/contrib/sitemaps/

I from django.contrib import sitemaps add this line

(r'^sitemap\.xml$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps': sitemaps})

to URLconf

make file sitemap.py with:

from django.contrib.sitemaps import Sitemap
from blog.models import Post

class BlogSitemap(Sitemap):
    changefreq = 'monthly'
    priority = 0.5

    def items(self):
        return Post.objects.all()

    def lastmod(self, obj):
        return obj.date

at this address http://127.0.0.1:8000/sitemap.xml I get an error:

Traceback:
File "/usr/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  100.                     response = callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/python2.7/site-packages/django/contrib/sitemaps/views.py" in sitemap
  33.         maps = sitemaps.values()

Exception Type: AttributeError at /sitemap.xml
Exception Value: 'module' object has no attribute 'values'

Anyone can help me?

7
задан Kubas 14 February 2011 в 19:02
поделиться