1 # -*- coding: utf-8 -*-
2 # This file is part of PrawoKultury, licensed under GNU Affero GPLv3 or later.
3 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
5 from django.contrib.sitemaps import Sitemap
6 from django.utils.translation import override
7 from .models import Entry
8 from django.conf import settings
11 class MigdalSitemap(Sitemap):
15 def __init__(self, lang):
19 return Entry.objects.filter(**{"published_%s" % self.lang: True})
21 def lastmod(self, obj):
24 def location(self, obj):
25 with override(self.lang):
26 return obj.get_absolute_url()
30 for lc, ln in settings.LANGUAGES:
31 sitemaps['entry_%s' % lc] = MigdalSitemap(lc)