Usage example
Closed this issue · 2 comments
Alir3z4 commented
I know it's drop-in replacement, but is there any usage example of this.
Currently I'm using this to setup sitemap stuff
from django.conf.urls import patterns
from django.contrib.sitemaps import GenericSitemap
from blog.models import Entry
info_dict = {
'queryset': Entry.objects.all(),
'date_field': 'pub_date',
}
sitemaps = {
'blog': GenericSitemap(info_dict, priority=0.6),
}
urlpatterns = patterns('',
# some generic view using info_dict
# ...
# the sitemap
(r'^sitemap\.xml$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps': sitemaps})
)
Is it going to override django internal sitemap or I should use it in such way as below;
from django.contrib.sitemaps import Sitemap
from blog.models import Entry
class BlogSitemap(Sitemap):
changefreq = "never"
priority = 0.5
def items(self):
return Entry.objects.filter(is_draft=False)
def lastmod(self, obj):
return obj.pub_date
Thanks ;)
cahitonur commented
I agree with that. It would be nice to have a usage example since I really don't understand what did you mean with drop in replacement.
litchfield commented
Thanks lads, updated the docs- check it out, real simple just edit your urls.py.