1 # -*- coding: utf-8 -*-
2 from django.conf.urls import url
3 from django.contrib import admin
4 from django.http.response import HttpResponse
5 from django.views.decorators.cache import never_cache
7 from newsletter.models import Subscription
10 class SubscriptionAdmin(admin.ModelAdmin):
12 urls = super(SubscriptionAdmin, self).get_urls()
14 url(r'^extract/$', self.extract_subscribers, name='extract_subscribers'),
19 def extract_subscribers(self, request):
20 active_subscriptions = Subscription.objects.filter(active=True)
21 return HttpResponse('\n'.join(active_subscriptions.values_list('email', flat=True)),
22 content_type='text/plain')
25 admin.site.register(Subscription, SubscriptionAdmin)