From 3c6061e46736c8673316f609ad5b5cb86dcd7096 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Thu, 26 Mar 2020 14:38:45 +0100 Subject: [PATCH 1/1] Export contacts as CSV. --- requirements/requirements.txt | 2 +- src/messaging/admin.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 19f36129f..e3bfb9cee 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -2,7 +2,7 @@ # django Django==2.2.10 -fnpdjango==0.4 +fnpdjango==0.4.5 docutils #django-pipeline==1.6.13 diff --git a/src/messaging/admin.py b/src/messaging/admin.py index 4ea538f62..6749106d6 100644 --- a/src/messaging/admin.py +++ b/src/messaging/admin.py @@ -1,6 +1,7 @@ from django.contrib import admin from django.contrib import messages from django.utils.translation import ugettext_lazy as _ +from fnpdjango.actions import export_as_csv_action from . import models @@ -83,6 +84,7 @@ class ContactAdmin(admin.ModelAdmin): list_display = ['email', 'level', 'since', 'expires_at'] search_fields = ['email'] date_hierarchy = 'since' + actions = [export_as_csv_action(fields=['id', 'email', 'get_level_display', 'since', 'expires_at'])] admin.site.register(models.Contact, ContactAdmin) -- 2.20.1