1 from django.contrib.sitemaps import Sitemap
2 from django.utils.translation import override
3 from .models import Entry
4 from django.conf import settings
6 class MigdalSitemap(Sitemap):
10 def __init__(self, lang):
14 return Entry.objects.filter(**{"published_%s" % self.lang: True})
16 def lastmod(self, obj):
19 def location(self, obj):
20 with override(self.lang):
21 return obj.get_absolute_url()
25 for lc, ln in settings.LANGUAGES:
26 sitemaps['entry_%s' % lc] = MigdalSitemap(lc)