I am using sites framework with RequestSite
(no SITE_ID
set) to generate content based on domain. I need to generate sitemaps for each domain with different results but I didnt find a way how to make this two frameworks work together. Is there any way to get Site
of the current request in Sitemap
? (getting it from SITE_ID
config is not an option for me).
Here is an example of what I would like to do:
from django.contrib.sitemaps import Sitemap
from blog.models import Entry
class BlogSitemap(Sitemap):
def items(self, request):
return Entry.objects.filter(is_draft=False, site=request.site)
But its not possible because there is no request
in items()
. Is there any other way how to filter items in sitemap based on site?