diff --git a/pgweb/lists/views.py b/pgweb/lists/views.py index 89c5c43b..c624096f 100644 --- a/pgweb/lists/views.py +++ b/pgweb/lists/views.py @@ -5,6 +5,7 @@ from django.contrib.auth.decorators import login_required from django.conf import settings from email.mime.text import MIMEText +import simplejson as json from pgweb.util.contexts import NavContext from pgweb.util.misc import sendmail @@ -52,3 +53,19 @@ mail-back anti-spam systems. These are extremely annoying to the list maintainer and other members, and you may be automatically unsubscribed.""" }, NavContext(request, "community")) +def listinfo(request): + resp = HttpResponse(mimetype='application/json') + groupdata = [ { + 'id': g.id, + 'name': g.groupname, + } for g in MailingListGroup.objects.all()] + listdata = [ { + 'id': l.id, + 'name': l.listname, + 'groupid': l.group_id, + 'active': l.active, + 'shortdesc': l.shortdesc, + 'description': l.description, + } for l in MailingList.objects.all()] + json.dump({'groups': groupdata, 'lists': listdata}, resp) + return resp diff --git a/pgweb/urls.py b/pgweb/urls.py index 3248c208..4cd8576a 100644 --- a/pgweb/urls.py +++ b/pgweb/urls.py @@ -51,6 +51,7 @@ urlpatterns = patterns('', (r'^community/contributors/$', 'contributors.views.completelist'), (r'^community/lists/$', 'lists.views.root'), (r'^community/lists/subscribe/$', 'lists.views.subscribe'), + (r'^community/lists/listinfo/$', 'lists.views.listinfo'), (r'^community/survey/vote/(\d+)/$', 'survey.views.vote'), (r'^community/survey[/\.](\d+)(-.*)?/$', 'survey.views.results'), (r'^community/weeklynews/$', 'pwn.views.index'),