From: Radek Czajka Date: Wed, 21 Oct 2020 08:42:49 +0000 (+0200) Subject: Export contacts with optout addresses. X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/700710d1aa59af7316ba9694711bfca051925677?ds=inline Export contacts with optout addresses. --- diff --git a/src/messaging/admin.py b/src/messaging/admin.py index 615e1e861..da58b3a53 100644 --- a/src/messaging/admin.py +++ b/src/messaging/admin.py @@ -71,7 +71,10 @@ 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'])] + actions = [ + export_as_csv_action(fields=['id', 'email', 'get_level_display', 'since', 'expires_at']), + export_as_csv_action('Eksport dla PHPList', fields=['email', 'wl_optout_url']) + ] admin.site.register(models.Contact, ContactAdmin) diff --git a/src/messaging/models.py b/src/messaging/models.py index fccd64776..d598fc852 100644 --- a/src/messaging/models.py +++ b/src/messaging/models.py @@ -163,6 +163,9 @@ class Contact(models.Model): self.expires_at = expires_at self.save() + def wl_optout_url(self): + return 'https://wolnelektury.pl' + self.get_optout_url() + class EmailSent(models.Model): template = models.ForeignKey(EmailTemplate, models.CASCADE)