X-Git-Url: https://git.mdrn.pl/edumed.git/blobdiff_plain/d0f0e1412cc42d366b234e798dfb68feed05d751..d555d988764995ea1f9f5ece46f453a66f09b334:/contact/management/commands/export_newsletter.py diff --git a/contact/management/commands/export_newsletter.py b/contact/management/commands/export_newsletter.py deleted file mode 100644 index 70ef2b4..0000000 --- a/contact/management/commands/export_newsletter.py +++ /dev/null @@ -1,34 +0,0 @@ -# -*- coding: utf-8 -*- -# This file is part of EduMed, licensed under GNU Affero GPLv3 or later. -# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. -# -from django.core.management.base import BaseCommand - -from contact.models import Contact -from edumed import contact_forms - -FORMS = ( - contact_forms.CooperateForm, - contact_forms.ContestForm, - contact_forms.WTEMForm, - contact_forms.TEMForm, - contact_forms.CybernauciForm, - contact_forms.WLEMForm, -) - - -class Command(BaseCommand): - help = 'Export contacts for newsletter.' - - def handle(self, **options): - addresses = set(self.get_addresses()) - for address in addresses: - print address - - def get_addresses(self): - for form in FORMS: - tags = [form.form_tag] + form.old_form_tags - contacts = Contact.objects.filter(form_tag__in=tags) - for contact in contacts: - if contact.body.get(form.mailing_field): - yield contact.contact