mirror of
https://github.com/postgres/pgweb.git
synced 2025-08-03 15:38:59 +00:00
25 lines
642 B
Python
25 lines
642 B
Python
from django.http import HttpResponse
|
|
|
|
import json
|
|
|
|
from .models import MailingList, MailingListGroup
|
|
|
|
|
|
def listinfo(request):
|
|
resp = HttpResponse(content_type='application/json')
|
|
groupdata = [{
|
|
'id': g.id,
|
|
'name': g.groupname,
|
|
'sort': g.sortkey,
|
|
} 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
|