summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2014-11-08 19:26:51 -0600
committerDan McGee <dan@archlinux.org>2014-11-08 19:26:51 -0600
commitb1aa075652f89efa4f1af9d62c214e93fd453001 (patch)
treee843b60f86d538f9256d484cefcfaacc9b8df2c6
parent327bd4cfc599dbeddd501afd5221a1d2ff7eee08 (diff)
Add a todolists sitemap
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--sitemaps.py22
-rw-r--r--urls.py1
2 files changed, 22 insertions, 1 deletions
diff --git a/sitemaps.py b/sitemaps.py
index fb81357e..03ad9254 100644
--- a/sitemaps.py
+++ b/sitemaps.py
@@ -8,6 +8,7 @@ from main.models import Package
from news.models import News
from packages.utils import get_group_info, get_split_packages_info
from releng.models import Release
+from todolists.models import Todolist
class PackagesSitemap(Sitemap):
@@ -112,7 +113,7 @@ class ReleasesSitemap(Sitemap):
return Release.objects.all().defer('info', 'torrent_data').order_by()
def lastmod(self, obj):
- return obj.created
+ return obj.last_modified
def priority(self, obj):
if obj.available:
@@ -120,6 +121,25 @@ class ReleasesSitemap(Sitemap):
return "0.2"
+class TodolistSitemap(Sitemap):
+ priority = "0.4"
+
+ def __init__(self):
+ now = datetime.utcnow().replace(tzinfo=utc)
+ self.two_weeks_ago = now - timedelta(days=14)
+
+ def items(self):
+ return Todolist.objects.all().defer('raw').order_by()
+
+ def lastmod(self, obj):
+ return obj.last_modified
+
+ def changefreq(self, obj):
+ if obj.last_modified > self.two_weeks_ago:
+ return 'weekly'
+ return 'monthly'
+
+
class BaseSitemap(Sitemap):
DEFAULT_PRIORITY = 0.7
diff --git a/urls.py b/urls.py
index c35baedf..36e3fef1 100644
--- a/urls.py
+++ b/urls.py
@@ -16,6 +16,7 @@ our_sitemaps = {
'package-groups': sitemaps.PackageGroupsSitemap,
'split-packages': sitemaps.SplitPackagesSitemap,
'releases': sitemaps.ReleasesSitemap,
+ 'todolists': sitemaps.TodolistSitemap,
}
news_sitemaps = { 'news': sitemaps.RecentNewsSitemap }