summaryrefslogtreecommitdiffstats
path: root/sitemaps.py
blob: e321fe85ca95144f9cc2a57ff00b8f07e0aae969 (plain)
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
from django.contrib.sitemaps import Sitemap
from main.models import Package
from news.models import News
from packages.utils import get_group_info

class PackagesSitemap(Sitemap):
    changefreq = "weekly"
    priority = "0.5"

    def items(self):
        return Package.objects.select_related('arch', 'repo').all()
        return Package.objects.all()

    def lastmod(self, obj):
        return obj.last_update


class PackageFilesSitemap(PackagesSitemap):
    changefreq = "monthly"
    priority = "0.3"

    def location(self, obj):
        return PackagesSitemap.location(self, obj) + 'files/'

    def lastmod(self, obj):
        return obj.files_last_update


class PackageGroupsSitemap(Sitemap):
    changefreq = "weekly"
    priority = "0.4"

    def items(self):
        return get_group_info()

    def lastmod(self, obj):
        return obj['last_update']

    def location(self, obj):
        return '/groups/%s/%s/' % (obj['arch'], obj['name'])


class NewsSitemap(Sitemap):
    changefreq = "never"
    priority = "0.7"

    def items(self):
        return News.objects.all()

    def lastmod(self, obj):
        return obj.postdate

# vim: set ts=4 sw=4 et: