sitemaps.py 847 Bytes
Newer Older
Thom Wiggers's avatar
Thom Wiggers committed
1
2
3
4
5
6
7
8
9
10
11
from django.contrib import sitemaps
from django.urls import reverse

from . import models


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

    def items(self):
12
        return ['activemembers:index']
Thom Wiggers's avatar
Thom Wiggers committed
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37

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


class CommitteeSitemap(sitemaps.Sitemap):

    def items(self):
        return models.Committee.active_committees.all()

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


class BoardSitemap(sitemaps.Sitemap):
    changefreq = 'yearly'

    def items(self):
        return models.Board.objects.all()

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


sitemap = {
38
39
40
    'activemembers-static': StaticViewSitemap,
    'activemembers-committees': CommitteeSitemap,
    'activemembers-boards': BoardSitemap,
Thom Wiggers's avatar
Thom Wiggers committed
41
}