From b44baaf9d84d145711bc55d134c16d39c2fb3684 Mon Sep 17 00:00:00 2001 From: Magnus Hagander Date: Mon, 4 May 2009 20:44:34 +0200 Subject: [PATCH] Add an RSS feed of all repositories, including those not approved yet. One good way to figure out if we've forgtten to approve something. --- gitadmin/adm/templates/feeds/all.tmpl | 5 +++++ gitadmin/feeds.py | 18 ++++++++++++++++++ gitadmin/urls.py | 10 ++++++++++ 3 files changed, 33 insertions(+) create mode 100644 gitadmin/adm/templates/feeds/all.tmpl create mode 100644 gitadmin/feeds.py diff --git a/gitadmin/adm/templates/feeds/all.tmpl b/gitadmin/adm/templates/feeds/all.tmpl new file mode 100644 index 0000000..e56e9c1 --- /dev/null +++ b/gitadmin/adm/templates/feeds/all.tmpl @@ -0,0 +1,5 @@ +{% if not obj.approved %} +

This repository has not yet been approved!

+{% endif %} +

{{obj.description}}

+ diff --git a/gitadmin/feeds.py b/gitadmin/feeds.py new file mode 100644 index 0000000..814cff0 --- /dev/null +++ b/gitadmin/feeds.py @@ -0,0 +1,18 @@ +# vim: ai ts=4 sts=4 sw=4 + +from django.contrib.syndication.feeds import Feed +from gitadmin.adm.models import * + +import datetime + +class AllReposFeed(Feed): + title = "pggit - all repositories" + link = "/" + description = "All pggit repositories, including those not approved yet" + description_template = "feeds/all.tmpl" + + def items(self): + return Repository.objects.all().order_by('repoid') + + def item_link(self, repo): + return "http://git.postgresql.org/gitweb/%s" % repo diff --git a/gitadmin/urls.py b/gitadmin/urls.py index a241287..8746be5 100644 --- a/gitadmin/urls.py +++ b/gitadmin/urls.py @@ -4,6 +4,14 @@ from django.conf.urls.defaults import * from django.contrib import admin admin.autodiscover() +from gitadmin.feeds import AllReposFeed + +# Feeds +feeds = { + 'all': AllReposFeed, +} + + urlpatterns = patterns('', # Uncomment the next line to enable admin documentation: # (r'^admin/doc/', include('django.contrib.admindocs.urls')), @@ -14,6 +22,8 @@ urlpatterns = patterns('', # Static (normally served by webserver) (r'^static/(?P.*)$', 'django.views.static.serve', {'document_root':'static/'}), +# Feeds + (r'^feeds/(?P.*)/$', 'django.contrib.syndication.views.feed', {'feed_dict': feeds}), (r'', include('gitadmin.adm.urls')), ) -- 2.39.5