sitemaps.py 592 Bytes
Newer Older
Thom Wiggers's avatar
Thom Wiggers committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from django.contrib import sitemaps
from django.urls import reverse

from . import models


class StaticViewSitemap(sitemaps.Sitemap):
    changefreq = 'daily'

    def items(self):
        return ['partners:index', 'partners:vacancies']

    def location(self, item):
        return reverse(item)


class PartnerSitemap(sitemaps.Sitemap):

    def items(self):
        return models.Partner.objects.filter(is_active=True)

    def location(self, item):
        return item.get_absolute_url()


sitemap = {
    'partners-static': StaticViewSitemap,
    'partners-partners': PartnerSitemap,
}