mirror of
https://github.com/postgres/pgweb.git
synced 2025-08-06 09:57:57 +00:00
Export list information as json
This makes it easier to sync information about which lists we have, and how they are grouped, to external sites (such as the search crawler)
This commit is contained in:
@ -5,6 +5,7 @@ from django.contrib.auth.decorators import login_required
|
|||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
from email.mime.text import MIMEText
|
from email.mime.text import MIMEText
|
||||||
|
import simplejson as json
|
||||||
|
|
||||||
from pgweb.util.contexts import NavContext
|
from pgweb.util.contexts import NavContext
|
||||||
from pgweb.util.misc import sendmail
|
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."""
|
and other members, and you may be automatically unsubscribed."""
|
||||||
}, NavContext(request, "community"))
|
}, 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
|
||||||
|
@ -51,6 +51,7 @@ urlpatterns = patterns('',
|
|||||||
(r'^community/contributors/$', 'contributors.views.completelist'),
|
(r'^community/contributors/$', 'contributors.views.completelist'),
|
||||||
(r'^community/lists/$', 'lists.views.root'),
|
(r'^community/lists/$', 'lists.views.root'),
|
||||||
(r'^community/lists/subscribe/$', 'lists.views.subscribe'),
|
(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/vote/(\d+)/$', 'survey.views.vote'),
|
||||||
(r'^community/survey[/\.](\d+)(-.*)?/$', 'survey.views.results'),
|
(r'^community/survey[/\.](\d+)(-.*)?/$', 'survey.views.results'),
|
||||||
(r'^community/weeklynews/$', 'pwn.views.index'),
|
(r'^community/weeklynews/$', 'pwn.views.index'),
|
||||||
|
Reference in New Issue
Block a user