summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2013-02-05 06:27:44 +0100
committerDan McGee <dan@archlinux.org>2013-02-09 04:12:46 +0100
commit445c242dac8f7c94f5d689fa3597ac573a4863a4 (patch)
treec87999c17b335874f104f548a00f287f5eac6ea5
parente65c7805547484cad1be55dfa20355ef18b857be (diff)
downloadarchweb-445c242dac8f7c94f5d689fa3597ac573a4863a4.tar.gz
archweb-445c242dac8f7c94f5d689fa3597ac573a4863a4.tar.xz
Add a releases model sitemap
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--sitemaps.py17
-rw-r--r--urls.py1
2 files changed, 18 insertions, 0 deletions
diff --git a/sitemaps.py b/sitemaps.py
index 110c588..b079d8b 100644
--- a/sitemaps.py
+++ b/sitemaps.py
@@ -7,6 +7,8 @@ from django.core.urlresolvers import reverse
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
+
class PackagesSitemap(Sitemap):
changefreq = "weekly"
@@ -86,6 +88,21 @@ class NewsSitemap(Sitemap):
return 'yearly'
+class ReleasesSitemap(Sitemap):
+ changefreq = "monthly"
+
+ def items(self):
+ return Release.objects.all().defer('info', 'torrent_data').order_by()
+
+ def lastmod(self, obj):
+ return obj.created
+
+ def priority(self, obj):
+ if obj.available:
+ return "0.6"
+ return "0.2"
+
+
class BaseSitemap(Sitemap):
DEFAULT_PRIORITY = 0.7
diff --git a/urls.py b/urls.py
index 97b84a3..e53d001 100644
--- a/urls.py
+++ b/urls.py
@@ -16,6 +16,7 @@ our_sitemaps = {
'package-files': sitemaps.PackageFilesSitemap,
'package-groups': sitemaps.PackageGroupsSitemap,
'split-packages': sitemaps.SplitPackagesSitemap,
+ 'releases': sitemaps.ReleasesSitemap,
}
admin.autodiscover()