Add sitemaps support to stores.

This commit is contained in:
2013-04-11 18:49:47 +01:00
parent 81857ad295
commit 12ee5733b4
3 changed files with 36 additions and 3 deletions

29
app/stores/sitemap.py Normal file
View File

@@ -0,0 +1,29 @@
from django.contrib.sitemaps import Sitemap
from stores.models import Store, Chain
class StoreSitemap(Sitemap):
changefreq = 'weekly'
priority = 1
def items(self):
return Chain.objects.filter(active=True)
def lastmod(self, obj):
return obj.changed
class ChainSitemap(Sitemap):
changefreq = 'weekly'
def items(self):
return Store.objects.filter(active=True)
def lastmod(self, obj):
return obj.changed
sitemaps = {
'stores': StoreSitemap,
'chains': ChainSitemap,
}