Unverified Commit 2c276ec0 authored by Joost Rijneveld's avatar Joost Rijneveld
Browse files

mailinglists: also include aliasses in API output

parent 0e21c0e6
{% for list in lists %}{{ list.pk }}
{% endfor %}END
{% for alias in list.aliasses.all %}{{ list.pk }}_{{ alias.alias }}
{% endfor %}{% endfor %}END
......@@ -24,12 +24,15 @@ def index(request):
if apihash != 'cb004452d9c80e295bebfc778871b3b082d70ad8':
raise PermissionDenied
if 'lists' in request.GET:
context = {'lists': MailingList.objects.all()}
context = {'lists': MailingList.objects.all()
return render(request, 'mailinglists/lists.txt', context,
elif 'list' in request.GET:
mailinglist = get_object_or_404(MailingList,
pk = request.GET['list'].split('_') # could be id_aliasname
mailinglist = get_object_or_404(MailingList, pk=int(pk[0]))
if len(pk) > 1 and mailinglist.aliasses.filter(alias=pk[1]):
mailinglist.name = pk[1]
return render(request, 'mailinglists/list_data.txt',
{'list': mailinglist}, content_type='text/plain')
elif 'membership_type' in request.GET:
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment