[extensions-web] Add RSS feed.
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [extensions-web] Add RSS feed.
- Date: Tue, 6 Dec 2011 03:14:32 +0000 (UTC)
commit b25fa945d10616c274ff493638c41ec541679624
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Mon Dec 5 22:14:27 2011 -0500
Add RSS feed.
sweettooth/extensions/feeds.py | 22 ++++++++++++++++++++++
sweettooth/extensions/urls.py | 4 +++-
sweettooth/templates/base.html | 2 ++
3 files changed, 27 insertions(+), 1 deletions(-)
---
diff --git a/sweettooth/extensions/feeds.py b/sweettooth/extensions/feeds.py
new file mode 100644
index 0000000..c3f89ec
--- /dev/null
+++ b/sweettooth/extensions/feeds.py
@@ -0,0 +1,22 @@
+
+from django.contrib.syndication.views import Feed
+from django.core.urlresolvers import reverse
+from extensions.models import Extension
+
+class LatestExtensionsFeed(Feed):
+ title = "Latest extensions in GNOME Shell Extensions"
+ link = "/"
+ description = "The latest extensions in GNOME Shell Extensions"
+
+ def items(self):
+ return Extension.objects.visible().order_by('pk')[-10:]
+
+ def item_title(self, item):
+ return item.name
+
+ def item_description(self, item):
+ return item.description
+
+ def item_link(self, item):
+ return reverse('extensions-detail', kwargs=dict(pk=item.pk,
+ slug=item.slug))
diff --git a/sweettooth/extensions/urls.py b/sweettooth/extensions/urls.py
index 8e36065..d26fb86 100644
--- a/sweettooth/extensions/urls.py
+++ b/sweettooth/extensions/urls.py
@@ -3,7 +3,7 @@ from django.conf.urls.defaults import patterns, include, url
from django.views.generic.simple import direct_to_template
from django.views.generic.list_detail import object_list
-from extensions import views, models
+from extensions import views, models, feeds
upload_patterns = patterns('',
url(r'^$', views.upload_file, dict(pk=None), name='extensions-upload-file'),
@@ -54,6 +54,8 @@ urlpatterns = patterns('',
url(r'^local/', direct_to_template, dict(template='extensions/local.html'), name='extensions-local'),
+ url(r'^rss/', LatestExtensionsFeed(), name='extensions-rss-feed'),
+
url(r'^upload/', include(upload_patterns)),
url(r'^ajax/', include(ajax_patterns)),
url(r'', include(shell_patterns)),
diff --git a/sweettooth/templates/base.html b/sweettooth/templates/base.html
index 1586394..318c759 100644
--- a/sweettooth/templates/base.html
+++ b/sweettooth/templates/base.html
@@ -4,6 +4,8 @@
<meta charset="utf-8" />
<link rel="stylesheet" href="/static/css/sweettooth.css" />
<link rel="shortcut icon" href="/static/images/favicon.png" />
+ <link rel="alternate" type="application/rss+xml"
+ href="{% url extensions-rss-feed %}" title="Latest extensions in GNOME Shell Extensions" />
{% block head %} {% endblock %}
<title>{% block title %}GNOME Shell Extensions{% endblock %}</title>
<script>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]