From d9db5238eadbcc259626a1868af0b202927d0114 Mon Sep 17 00:00:00 2001 From: alpcentaur Date: Mon, 27 Feb 2023 17:09:29 +0000 Subject: [PATCH] added mail_state to all objects, added filters regarding sendmail.py --- .gitignore | 3 +- LICENSE | 0 README.md | 0 TODO | 0 foerderbarometer/__init__.py | 0 foerderbarometer/asgi.py | 0 foerderbarometer/settings.py_old | 0 foerderbarometer/settings_development.py | 0 .../settings_mariadb_development.py | 0 foerderbarometer/settings_production.py | 4 +- foerderbarometer/urls.py | 0 foerderbarometer/wsgi.py | 0 input/__init__.py | 0 input/admin.py | 0 input/apps.py | 0 input/fixtures/accounts.json | 0 input/forms.py | 6 +- input/management/commands/sendmails.py | 75 +++++++---- input/migrations/0001_initial.py | 0 input/migrations/0002_auto_20200922_1340.py | 0 input/migrations/0003_volonteer.py | 0 input/migrations/0004_project_contact.py | 0 input/migrations/0005_auto_20200930_1015.py | 0 input/migrations/0006_honorarycertificate.py | 0 input/migrations/0007_library.py | 0 input/migrations/0008_ifg.py | 0 input/migrations/0009_project_pid.py | 0 input/migrations/0010_auto_20201007_0732.py | 0 input/migrations/0011_auto_20201007_0743.py | 0 input/migrations/0012_auto_20201007_0754.py | 0 input/migrations/0013_library_type.py | 0 input/migrations/0014_auto_20201020_0714.py | 0 input/migrations/0015_auto_20201021_0721.py | 0 input/migrations/0016_project_account.py | 0 input/migrations/0017_auto_20201021_1145.py | 0 input/migrations/0018_auto_20201021_1147.py | 0 input/migrations/0019_auto_20201021_1148.py | 0 .../0020_project_project_end_mail.py | 0 input/migrations/0021_auto_20201022_0934.py | 0 input/migrations/0022_auto_20201022_1233.py | 0 input/migrations/0023_auto_20201022_1400.py | 0 input/migrations/0024_travel.py | 0 input/migrations/0025_auto_20201026_1048.py | 0 input/migrations/0026_auto_20201026_1214.py | 0 .../0027_businesscard_email_list.py | 0 input/migrations/0028_auto_20201027_1131.py | 0 input/migrations/0029_auto_20201027_1247.py | 0 input/migrations/0030_auto_20201027_1337.py | 0 input/migrations/0031_auto_20201028_1402.py | 0 input/migrations/0032_auto_20201029_1213.py | 0 input/migrations/0033_auto_20201029_1338.py | 0 input/migrations/0034_auto_20201102_0913.py | 0 input/migrations/0035_auto_20201102_0944.py | 0 input/migrations/0036_auto_20201102_1049.py | 0 input/migrations/0037_auto_20201102_1054.py | 0 input/migrations/0038_auto_20201102_1055.py | 0 input/migrations/0039_auto_20201102_1212.py | 0 input/migrations/0040_auto_20201102_1302.py | 0 input/migrations/0041_auto_20201102_1318.py | 0 input/migrations/0042_auto_20201102_1319.py | 0 input/migrations/0043_auto_20201102_1320.py | 0 input/migrations/0044_auto_20201103_1545.py | 0 input/migrations/0044_auto_20201116_1531.py | 0 input/migrations/0045_auto_20201116_1557.py | 0 input/migrations/0046_auto_20201117_1542.py | 0 input/migrations/0047_auto_20201117_1546.py | 0 input/migrations/0048_auto_20201118_1503.py | 0 input/migrations/0049_auto_20201118_1509.py | 0 input/migrations/0050_auto_20201118_1512.py | 0 input/migrations/0051_auto_20201118_1521.py | 0 input/migrations/0052_auto_20201118_1524.py | 0 input/migrations/0053_auto_20201118_1531.py | 0 input/migrations/0054_auto_20201118_1702.py | 0 input/migrations/0055_merge_20201118_1734.py | 0 input/migrations/0056_auto_20201217_1215.py | 0 input/migrations/0057_auto_20210104_0937.py | 0 input/migrations/0058_auto_20210412_0946.py | 0 input/migrations/0059_auto_20210412_1142.py | 0 input/migrations/0060_concreteextern.py | 0 input/migrations/0061_concretevolunteer.py | 0 input/migrations/0062_auto_20211103_1155.py | 0 ...ard_url_of_pic_alter_ifg_notes_and_more.py | 0 ...ta_to_print_literature_selfbuy_and_more.py | 0 .../0065_alter_literature_selfbuy_and_more.py | 0 input/migrations/0066_email_adult.py | 0 ..._travel_project_name_alter_library_type.py | 0 input/migrations/0068_travel_hotel.py | 0 .../migrations/0069_alter_travel_transport.py | 0 input/migrations/0070_alter_travel_project.py | 0 ...ficate_intern_notes_travel_intern_notes.py | 0 ...ntern_notes_email_intern_notes_and_more.py | 0 input/migrations/0073_account_intern_notes.py | 0 input/migrations/0074_project_intern_notes.py | 0 .../0075_literature_selfbuy_data.py | 0 input/migrations/0076_auto_20221129_1601.py | 78 +++++++++++ input/migrations/0077_auto_20221129_1706.py | 123 ++++++++++++++++++ input/migrations/0078_auto_20221129_1712.py | 68 ++++++++++ input/migrations/0079_auto_20221129_2310.py | 68 ++++++++++ input/migrations/0080_auto_20221129_2323.py | 68 ++++++++++ input/migrations/__init__.py | 0 input/models.py | 6 + input/settings.py | 0 input/static/dropdown/js/base.js | 0 input/static/input/logo.png | Bin input/static/input/nutzungsbedingungen.html | 0 input/templates/input/extern.html | 0 input/templates/input/if_end_of_project.html | 0 input/templates/input/if_end_of_project.txt | 0 .../input/if_end_of_project_approved.html | 0 .../input/if_end_of_project_approved.txt | 0 .../input/if_end_of_project_orginformed.html | 0 .../input/if_end_of_project_orginformed.txt | 0 input/templates/input/if_mail.html | 0 input/templates/input/if_mail.txt | 0 .../input/if_not_of_project_approved.html | 0 .../input/if_not_of_project_approved.txt | 0 input/templates/input/ifg_volunteer_mail.html | 0 input/templates/input/ifg_volunteer_mail.txt | 0 input/templates/input/survey_mail.html | 0 input/templates/input/survey_mail.txt | 0 input/templates/registration/login.html | 0 input/tests.py | 0 input/urls.py | 0 input/views.py | 8 +- requirements.txt | 7 + 125 files changed, 482 insertions(+), 32 deletions(-) mode change 100644 => 100755 .gitignore mode change 100644 => 100755 LICENSE mode change 100644 => 100755 README.md mode change 100644 => 100755 TODO mode change 100644 => 100755 foerderbarometer/__init__.py mode change 100644 => 100755 foerderbarometer/asgi.py mode change 100644 => 100755 foerderbarometer/settings.py_old mode change 100644 => 100755 foerderbarometer/settings_development.py mode change 100644 => 100755 foerderbarometer/settings_mariadb_development.py mode change 100644 => 100755 foerderbarometer/settings_production.py mode change 100644 => 100755 foerderbarometer/urls.py mode change 100644 => 100755 foerderbarometer/wsgi.py mode change 100644 => 100755 input/__init__.py mode change 100644 => 100755 input/admin.py mode change 100644 => 100755 input/apps.py mode change 100644 => 100755 input/fixtures/accounts.json mode change 100644 => 100755 input/forms.py mode change 100644 => 100755 input/management/commands/sendmails.py mode change 100644 => 100755 input/migrations/0001_initial.py mode change 100644 => 100755 input/migrations/0002_auto_20200922_1340.py mode change 100644 => 100755 input/migrations/0003_volonteer.py mode change 100644 => 100755 input/migrations/0004_project_contact.py mode change 100644 => 100755 input/migrations/0005_auto_20200930_1015.py mode change 100644 => 100755 input/migrations/0006_honorarycertificate.py mode change 100644 => 100755 input/migrations/0007_library.py mode change 100644 => 100755 input/migrations/0008_ifg.py mode change 100644 => 100755 input/migrations/0009_project_pid.py mode change 100644 => 100755 input/migrations/0010_auto_20201007_0732.py mode change 100644 => 100755 input/migrations/0011_auto_20201007_0743.py mode change 100644 => 100755 input/migrations/0012_auto_20201007_0754.py mode change 100644 => 100755 input/migrations/0013_library_type.py mode change 100644 => 100755 input/migrations/0014_auto_20201020_0714.py mode change 100644 => 100755 input/migrations/0015_auto_20201021_0721.py mode change 100644 => 100755 input/migrations/0016_project_account.py mode change 100644 => 100755 input/migrations/0017_auto_20201021_1145.py mode change 100644 => 100755 input/migrations/0018_auto_20201021_1147.py mode change 100644 => 100755 input/migrations/0019_auto_20201021_1148.py mode change 100644 => 100755 input/migrations/0020_project_project_end_mail.py mode change 100644 => 100755 input/migrations/0021_auto_20201022_0934.py mode change 100644 => 100755 input/migrations/0022_auto_20201022_1233.py mode change 100644 => 100755 input/migrations/0023_auto_20201022_1400.py mode change 100644 => 100755 input/migrations/0024_travel.py mode change 100644 => 100755 input/migrations/0025_auto_20201026_1048.py mode change 100644 => 100755 input/migrations/0026_auto_20201026_1214.py mode change 100644 => 100755 input/migrations/0027_businesscard_email_list.py mode change 100644 => 100755 input/migrations/0028_auto_20201027_1131.py mode change 100644 => 100755 input/migrations/0029_auto_20201027_1247.py mode change 100644 => 100755 input/migrations/0030_auto_20201027_1337.py mode change 100644 => 100755 input/migrations/0031_auto_20201028_1402.py mode change 100644 => 100755 input/migrations/0032_auto_20201029_1213.py mode change 100644 => 100755 input/migrations/0033_auto_20201029_1338.py mode change 100644 => 100755 input/migrations/0034_auto_20201102_0913.py mode change 100644 => 100755 input/migrations/0035_auto_20201102_0944.py mode change 100644 => 100755 input/migrations/0036_auto_20201102_1049.py mode change 100644 => 100755 input/migrations/0037_auto_20201102_1054.py mode change 100644 => 100755 input/migrations/0038_auto_20201102_1055.py mode change 100644 => 100755 input/migrations/0039_auto_20201102_1212.py mode change 100644 => 100755 input/migrations/0040_auto_20201102_1302.py mode change 100644 => 100755 input/migrations/0041_auto_20201102_1318.py mode change 100644 => 100755 input/migrations/0042_auto_20201102_1319.py mode change 100644 => 100755 input/migrations/0043_auto_20201102_1320.py mode change 100644 => 100755 input/migrations/0044_auto_20201103_1545.py mode change 100644 => 100755 input/migrations/0044_auto_20201116_1531.py mode change 100644 => 100755 input/migrations/0045_auto_20201116_1557.py mode change 100644 => 100755 input/migrations/0046_auto_20201117_1542.py mode change 100644 => 100755 input/migrations/0047_auto_20201117_1546.py mode change 100644 => 100755 input/migrations/0048_auto_20201118_1503.py mode change 100644 => 100755 input/migrations/0049_auto_20201118_1509.py mode change 100644 => 100755 input/migrations/0050_auto_20201118_1512.py mode change 100644 => 100755 input/migrations/0051_auto_20201118_1521.py mode change 100644 => 100755 input/migrations/0052_auto_20201118_1524.py mode change 100644 => 100755 input/migrations/0053_auto_20201118_1531.py mode change 100644 => 100755 input/migrations/0054_auto_20201118_1702.py mode change 100644 => 100755 input/migrations/0055_merge_20201118_1734.py mode change 100644 => 100755 input/migrations/0056_auto_20201217_1215.py mode change 100644 => 100755 input/migrations/0057_auto_20210104_0937.py mode change 100644 => 100755 input/migrations/0058_auto_20210412_0946.py mode change 100644 => 100755 input/migrations/0059_auto_20210412_1142.py mode change 100644 => 100755 input/migrations/0060_concreteextern.py mode change 100644 => 100755 input/migrations/0061_concretevolunteer.py mode change 100644 => 100755 input/migrations/0062_auto_20211103_1155.py mode change 100644 => 100755 input/migrations/0063_businesscard_url_of_pic_alter_ifg_notes_and_more.py mode change 100644 => 100755 input/migrations/0064_businesscard_send_data_to_print_literature_selfbuy_and_more.py mode change 100644 => 100755 input/migrations/0065_alter_literature_selfbuy_and_more.py mode change 100644 => 100755 input/migrations/0066_email_adult.py mode change 100644 => 100755 input/migrations/0067_travel_project_name_alter_library_type.py mode change 100644 => 100755 input/migrations/0068_travel_hotel.py mode change 100644 => 100755 input/migrations/0069_alter_travel_transport.py mode change 100644 => 100755 input/migrations/0070_alter_travel_project.py mode change 100644 => 100755 input/migrations/0071_honorarycertificate_intern_notes_travel_intern_notes.py mode change 100644 => 100755 input/migrations/0072_businesscard_intern_notes_email_intern_notes_and_more.py mode change 100644 => 100755 input/migrations/0073_account_intern_notes.py mode change 100644 => 100755 input/migrations/0074_project_intern_notes.py mode change 100644 => 100755 input/migrations/0075_literature_selfbuy_data.py create mode 100644 input/migrations/0076_auto_20221129_1601.py create mode 100644 input/migrations/0077_auto_20221129_1706.py create mode 100644 input/migrations/0078_auto_20221129_1712.py create mode 100644 input/migrations/0079_auto_20221129_2310.py create mode 100644 input/migrations/0080_auto_20221129_2323.py mode change 100644 => 100755 input/migrations/__init__.py mode change 100644 => 100755 input/models.py mode change 100644 => 100755 input/settings.py mode change 100644 => 100755 input/static/dropdown/js/base.js mode change 100644 => 100755 input/static/input/logo.png mode change 100644 => 100755 input/static/input/nutzungsbedingungen.html mode change 100644 => 100755 input/templates/input/extern.html mode change 100644 => 100755 input/templates/input/if_end_of_project.html mode change 100644 => 100755 input/templates/input/if_end_of_project.txt mode change 100644 => 100755 input/templates/input/if_end_of_project_approved.html mode change 100644 => 100755 input/templates/input/if_end_of_project_approved.txt mode change 100644 => 100755 input/templates/input/if_end_of_project_orginformed.html mode change 100644 => 100755 input/templates/input/if_end_of_project_orginformed.txt mode change 100644 => 100755 input/templates/input/if_mail.html mode change 100644 => 100755 input/templates/input/if_mail.txt mode change 100644 => 100755 input/templates/input/if_not_of_project_approved.html mode change 100644 => 100755 input/templates/input/if_not_of_project_approved.txt mode change 100644 => 100755 input/templates/input/ifg_volunteer_mail.html mode change 100644 => 100755 input/templates/input/ifg_volunteer_mail.txt mode change 100644 => 100755 input/templates/input/survey_mail.html mode change 100644 => 100755 input/templates/input/survey_mail.txt mode change 100644 => 100755 input/templates/registration/login.html mode change 100644 => 100755 input/tests.py mode change 100644 => 100755 input/urls.py mode change 100644 => 100755 input/views.py create mode 100755 requirements.txt diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 index bc0ab41..1139068 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,8 @@ # secret passwords and so /secrets.json /staticfiles -/foerderbarometer/settings.py +# /foerderbarometer/settings.py +/foerderbarometer/*settings* /nohup.out /logfile *~ diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/TODO b/TODO old mode 100644 new mode 100755 diff --git a/foerderbarometer/__init__.py b/foerderbarometer/__init__.py old mode 100644 new mode 100755 diff --git a/foerderbarometer/asgi.py b/foerderbarometer/asgi.py old mode 100644 new mode 100755 diff --git a/foerderbarometer/settings.py_old b/foerderbarometer/settings.py_old old mode 100644 new mode 100755 diff --git a/foerderbarometer/settings_development.py b/foerderbarometer/settings_development.py old mode 100644 new mode 100755 diff --git a/foerderbarometer/settings_mariadb_development.py b/foerderbarometer/settings_mariadb_development.py old mode 100644 new mode 100755 diff --git a/foerderbarometer/settings_production.py b/foerderbarometer/settings_production.py old mode 100644 new mode 100755 index 720e689..7a77496 --- a/foerderbarometer/settings_production.py +++ b/foerderbarometer/settings_production.py @@ -111,8 +111,8 @@ WSGI_APPLICATION = 'foerderbarometer.wsgi.application' DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', - 'NAME': 'fdb', - 'USER': 'fdb', + 'NAME': 'fdbdevel', + 'USER': 'fdbdevel', 'PASSWORD': get_secret('DATABASE_PASSWORD'), 'HOST': '10.0.6.7', # Or an IP Address that your database is hosted on # 'PORT': '3306', diff --git a/foerderbarometer/urls.py b/foerderbarometer/urls.py old mode 100644 new mode 100755 diff --git a/foerderbarometer/wsgi.py b/foerderbarometer/wsgi.py old mode 100644 new mode 100755 diff --git a/input/__init__.py b/input/__init__.py old mode 100644 new mode 100755 diff --git a/input/admin.py b/input/admin.py old mode 100644 new mode 100755 diff --git a/input/apps.py b/input/apps.py old mode 100644 new mode 100755 diff --git a/input/fixtures/accounts.json b/input/fixtures/accounts.json old mode 100644 new mode 100755 diff --git a/input/forms.py b/input/forms.py old mode 100644 new mode 100755 index e2e6d07..c8e6897 --- a/input/forms.py +++ b/input/forms.py @@ -72,13 +72,13 @@ class TravelForm(FdbForm): exclude = ('granted', 'granted_date', 'survey_mail_send', 'realname', 'email', 'survey_mail_date', 'project', 'request_url', 'payed_for_hotel_by', 'payed_for_travel_by', 'intern_notes' ) widgets = {'checkin': AdminDateWidget(), 'checkout': AdminDateWidget(),} - fields = ['project_name', 'transport', 'travelcost', 'checkin', 'checkout', 'hotel', 'notes'] + fields = ['project_name', 'transport', 'travelcost', 'checkin', 'checkout', 'hotel', 'notes', 'mail_state'] class LibraryForm(FdbForm): class Meta: model = Library - fields = ['cost', 'library', 'duration', 'notes'] + fields = ['cost', 'library', 'duration', 'notes', 'survey_mail_send'] exclude = ['intern_notes'] class HonoraryCertificateForm(FdbForm): @@ -139,7 +139,7 @@ class BusinessCardForm(CheckForm): class Meta: model = BusinessCard exclude = ['intern_notes'] - fields = ['project', 'data', 'variant', 'url_of_pic', 'sent_to'] + fields = ['project', 'data', 'variant', 'url_of_pic', 'sent_to', 'mail_state'] class Media: js = ('dropdown/js/base.js',) diff --git a/input/management/commands/sendmails.py b/input/management/commands/sendmails.py old mode 100644 new mode 100755 index e08c877..9451cac --- a/input/management/commands/sendmails.py +++ b/input/management/commands/sendmails.py @@ -39,11 +39,12 @@ class Command(BaseCommand): html_mail_template = get_template('input/survey_mail.html') try: subject, from_email, to = 'Dein Feedback zur Förderung durch Wikimedia Deutschland', IF_EMAIL, email - text_content = txt_mail_template.render(context) - html_content = html_mail_template.render(context) - msg = EmailMultiAlternatives(subject, text_content, from_email, [to], bcc=[SURVEY_EMAIL]) - msg.attach_alternative(html_content, "text/html") - msg.send() + text_content = txt_mail_template.render(context) + html_content = html_mail_template.render(context) + msg = EmailMultiAlternatives(subject, text_content, from_email, [to], bcc=[SURVEY_EMAIL]) + msg.attach_alternative(html_content, "text/html") + msg.send() + #print('survey mail would have been send') #survey_mail = EmailMessage('Dein Feedback zur Förderung durch Wikimedia Deutschland', # mail_template.render(context), @@ -56,12 +57,19 @@ class Command(BaseCommand): print(f'send surveylinkemail to {email}...') + ''' the db entry mail_state was added. Useful when migrating databases. first delete the entry, then makemigrations + then migrate.. after that, recreate the entry with default END, after that makemigrations and migrate. + now all entries have the value END. after that rewrite the default to NONE in models.py, then makemigrations + and migrate again, to have NONE as default for all new queries. ''' + + def end_of_projects_reached(self): ''' end of project reached ''' # get all projects which ended old = Project.objects.filter(end__lt = date.today())\ - .exclude(end_mail_send = True) + .exclude(end_mail_send = True)\ + .filter(mail_state = 'NONE') txt_mail_template = get_template('input/if_end_of_project.txt') html_mail_template = get_template('input/if_end_of_project.html') @@ -69,6 +77,7 @@ class Command(BaseCommand): for project in old: context = {'project': project} context['URLPREFIX'] = settings.URLPREFIX + try: subject, from_email, to = 'Projektende erreicht', IF_EMAIL, IF_EMAIL text_content = txt_mail_template.render(context) @@ -76,6 +85,7 @@ class Command(BaseCommand): msg = EmailMultiAlternatives(subject, text_content, from_email, [to]) msg.attach_alternative(html_content, "text/html") msg.send() + #print('end of project mail would have been sent') #send_mail('Projektende erreicht', # mail_template.render(context), @@ -83,7 +93,11 @@ class Command(BaseCommand): # [IF_EMAIL], # fail_silently=False) project.end_mail_send = True - project.save() + project.mail_state = 'INF' + try: + project.save() + except: + print( 'For project', project, 'there is possibly no project.start (', project.start, ') class') except BadHeaderError: self.stdout.write(self.style.ERROR('Invalid header found.')) @@ -94,8 +108,8 @@ class Command(BaseCommand): # get all projects where end was reached already, and send mails for the ones already set to status "ended" by the admins approved_end = Project.objects.filter(status = 'END')\ - .exclude(end_mail_send = False) - print(approved_end) + .exclude(end_mail_send = False)\ + .filter(mail_state = 'INF') txt_mail_template = get_template('input/if_end_of_project_approved.txt') html_mail_template = get_template('input/if_end_of_project_approved.html') @@ -106,6 +120,8 @@ class Command(BaseCommand): for project in approved_end: context = {'project': project} context['URLPREFIX'] = settings.URLPREFIX + + try: subject, from_email, to = 'Projektende erreicht', IF_EMAIL, project.email text_content = txt_mail_template.render(context) @@ -113,14 +129,15 @@ class Command(BaseCommand): msg = EmailMultiAlternatives(subject, text_content, from_email, [to]) msg.attach_alternative(html_content, "text/html") msg.send() + #print('if and of project approved mail would have been sent') - inform_subject, inform_from_email, inform_to = Projektorganisator*in wurde informiert', IF_EMAIL, IF_EMAIL + inform_subject, inform_from_email, inform_to = 'Projektorganisator*in wurde informiert', IF_EMAIL, IF_EMAIL inform_text_content = txt_informMail_template.render(context) inform_html_content = html_informMail_template.render(context) inform_msg = EmailMultiAlternatives(inform_subject, inform_text_content, inform_from_email, [inform_to]) inform_msg.attach_alternative(html_content, "text/html") inform_msg.send() - + #print('if end of project orginformed mail would have been sent') #send_mail('Projektende erreicht', # mail_template.render(context), @@ -134,7 +151,11 @@ class Command(BaseCommand): # fail_silently=False) project.end_mail_send = True - project.save() + project.mail_state = 'END' + try: + project.save() + except: + print( 'For project', project, 'there is possibly no project.start (', project.start, ') class') except BadHeaderError: self.stdout.write(self.style.ERROR('Invalid header found.')) @@ -145,7 +166,8 @@ class Command(BaseCommand): # get all projects where end was reached already, and send mails for the ones where status was put to NOT by admins approved_notHappened = Project.objects.filter(status = 'NOT')\ - .exclude(end_mail_send = False) + .exclude(end_mail_send = False)\ + .filter(mail_state = 'INF') html_mail_template = get_template('input/if_not_of_project_approved.html') txt_mail_template = get_template('input/if_not_of_project_approved.txt') @@ -164,7 +186,7 @@ class Command(BaseCommand): msg = EmailMultiAlternatives(subject, text_content, from_email, [to]) msg.attach_alternative(html_content, "text/html") msg.send() - + #print('if not of project approved end mail would have been sent') #send_mail('Projektende erreicht', @@ -173,12 +195,13 @@ class Command(BaseCommand): # [project.email], # fail_silently=False) - inform_subject, inform_from_email, inform_to = Projektorganisator*in wurde informiert', IF_EMAIL, IF_EMAIL + inform_subject, inform_from_email, inform_to = 'Projektorganisator*in wurde informiert', IF_EMAIL, IF_EMAIL inform_text_content = txt_informMail_template.render(context) inform_html_content = html_informMail_template.render(context) inform_msg = EmailMultiAlternatives(inform_subject, inform_text_content, inform_from_email, [inform_to]) inform_msg.attach_alternative(html_content, "text/html") inform_msg.send() + #print('if not of project approved end mail orginformed would have been sent') #send_mail('Projektorganisator*in wurde informiert', # informMail_template.render(context), @@ -187,6 +210,7 @@ class Command(BaseCommand): # fail_silently=False) project.end_mail_send = True + project.mail_state = 'END' project.save() except BadHeaderError: self.stdout.write(self.style.ERROR('Invalid header found.')) @@ -221,7 +245,8 @@ class Command(BaseCommand): supported = Library.objects.filter(granted=True)\ .filter(granted_date__lt = date.today() - timedelta(days=14))\ - .exclude(survey_mail_send=True) + .exclude(survey_mail_send=True)\ + .exclude(mail_state = 'END') self.surveymails_to_object(supported,name='library') def surveymails_to_hon(self): @@ -229,7 +254,8 @@ class Command(BaseCommand): supported = HonoraryCertificate.objects.filter(granted=True)\ .filter(granted_date__lt = date.today() - timedelta(days=14))\ - .exclude(survey_mail_send=True) + .exclude(survey_mail_send=True)\ + .exclude(mail_state = 'END') self.surveymails_to_object(supported, type='HON', name='project') def surveymails_to_ifg(self): @@ -237,7 +263,8 @@ class Command(BaseCommand): supported = IFG.objects.filter(granted=True)\ .filter(granted_date__lt = date.today() - timedelta(days=14))\ - .exclude(survey_mail_send=True) + .exclude(survey_mail_send=True)\ + .exclude(mail_state = 'END') self.surveymails_to_object(supported, type='IFG', name='url') def surveymails_to_lit(self): @@ -245,14 +272,16 @@ class Command(BaseCommand): supported = Literature.objects.filter(granted=True)\ .filter(granted_date__lt = date.today() - timedelta(days=14))\ - .exclude(survey_mail_send=True) + .exclude(survey_mail_send=True)\ + .exclude(mail_state = 'END') self.surveymails_to_object(supported, type='LIT', name='info') def surveymails_to_project(self): '''send survey link 4 weeks after end of project reached''' supported = Project.objects.filter(granted=True)\ .filter(end__lt = date.today() - timedelta(days=28))\ - .exclude(survey_mail_send=True) + .exclude(survey_mail_send=True)\ + .exclude(mail_state = 'END') self.surveymails_to_object(supported, type='PRO', name='name') def surveymails_to_travel(self): @@ -260,7 +289,8 @@ class Command(BaseCommand): supported = Travel.objects.filter(project__granted=True)\ .filter(project__end__lt = date.today() - timedelta(days=21))\ - .exclude(survey_mail_send=True) + .exclude(survey_mail_send=True)\ + .exclude(mail_state = 'END') self.surveymails_to_object(supported, type='TRAV', name='project') def surveymails_to_mail_vis_lis(self): @@ -273,7 +303,8 @@ class Command(BaseCommand): # get class via string supported = getattr(sys.modules[__name__], c).objects.filter(granted=True)\ .filter(granted_date__lt = lastdate)\ - .exclude(survey_mail_send=True) + .exclude(survey_mail_send=True)\ + .exclude(mail_state = 'END') self.surveymails_to_object(supported, type=typefield[count]) count += 1 diff --git a/input/migrations/0001_initial.py b/input/migrations/0001_initial.py old mode 100644 new mode 100755 diff --git a/input/migrations/0002_auto_20200922_1340.py b/input/migrations/0002_auto_20200922_1340.py old mode 100644 new mode 100755 diff --git a/input/migrations/0003_volonteer.py b/input/migrations/0003_volonteer.py old mode 100644 new mode 100755 diff --git a/input/migrations/0004_project_contact.py b/input/migrations/0004_project_contact.py old mode 100644 new mode 100755 diff --git a/input/migrations/0005_auto_20200930_1015.py b/input/migrations/0005_auto_20200930_1015.py old mode 100644 new mode 100755 diff --git a/input/migrations/0006_honorarycertificate.py b/input/migrations/0006_honorarycertificate.py old mode 100644 new mode 100755 diff --git a/input/migrations/0007_library.py b/input/migrations/0007_library.py old mode 100644 new mode 100755 diff --git a/input/migrations/0008_ifg.py b/input/migrations/0008_ifg.py old mode 100644 new mode 100755 diff --git a/input/migrations/0009_project_pid.py b/input/migrations/0009_project_pid.py old mode 100644 new mode 100755 diff --git a/input/migrations/0010_auto_20201007_0732.py b/input/migrations/0010_auto_20201007_0732.py old mode 100644 new mode 100755 diff --git a/input/migrations/0011_auto_20201007_0743.py b/input/migrations/0011_auto_20201007_0743.py old mode 100644 new mode 100755 diff --git a/input/migrations/0012_auto_20201007_0754.py b/input/migrations/0012_auto_20201007_0754.py old mode 100644 new mode 100755 diff --git a/input/migrations/0013_library_type.py b/input/migrations/0013_library_type.py old mode 100644 new mode 100755 diff --git a/input/migrations/0014_auto_20201020_0714.py b/input/migrations/0014_auto_20201020_0714.py old mode 100644 new mode 100755 diff --git a/input/migrations/0015_auto_20201021_0721.py b/input/migrations/0015_auto_20201021_0721.py old mode 100644 new mode 100755 diff --git a/input/migrations/0016_project_account.py b/input/migrations/0016_project_account.py old mode 100644 new mode 100755 diff --git a/input/migrations/0017_auto_20201021_1145.py b/input/migrations/0017_auto_20201021_1145.py old mode 100644 new mode 100755 diff --git a/input/migrations/0018_auto_20201021_1147.py b/input/migrations/0018_auto_20201021_1147.py old mode 100644 new mode 100755 diff --git a/input/migrations/0019_auto_20201021_1148.py b/input/migrations/0019_auto_20201021_1148.py old mode 100644 new mode 100755 diff --git a/input/migrations/0020_project_project_end_mail.py b/input/migrations/0020_project_project_end_mail.py old mode 100644 new mode 100755 diff --git a/input/migrations/0021_auto_20201022_0934.py b/input/migrations/0021_auto_20201022_0934.py old mode 100644 new mode 100755 diff --git a/input/migrations/0022_auto_20201022_1233.py b/input/migrations/0022_auto_20201022_1233.py old mode 100644 new mode 100755 diff --git a/input/migrations/0023_auto_20201022_1400.py b/input/migrations/0023_auto_20201022_1400.py old mode 100644 new mode 100755 diff --git a/input/migrations/0024_travel.py b/input/migrations/0024_travel.py old mode 100644 new mode 100755 diff --git a/input/migrations/0025_auto_20201026_1048.py b/input/migrations/0025_auto_20201026_1048.py old mode 100644 new mode 100755 diff --git a/input/migrations/0026_auto_20201026_1214.py b/input/migrations/0026_auto_20201026_1214.py old mode 100644 new mode 100755 diff --git a/input/migrations/0027_businesscard_email_list.py b/input/migrations/0027_businesscard_email_list.py old mode 100644 new mode 100755 diff --git a/input/migrations/0028_auto_20201027_1131.py b/input/migrations/0028_auto_20201027_1131.py old mode 100644 new mode 100755 diff --git a/input/migrations/0029_auto_20201027_1247.py b/input/migrations/0029_auto_20201027_1247.py old mode 100644 new mode 100755 diff --git a/input/migrations/0030_auto_20201027_1337.py b/input/migrations/0030_auto_20201027_1337.py old mode 100644 new mode 100755 diff --git a/input/migrations/0031_auto_20201028_1402.py b/input/migrations/0031_auto_20201028_1402.py old mode 100644 new mode 100755 diff --git a/input/migrations/0032_auto_20201029_1213.py b/input/migrations/0032_auto_20201029_1213.py old mode 100644 new mode 100755 diff --git a/input/migrations/0033_auto_20201029_1338.py b/input/migrations/0033_auto_20201029_1338.py old mode 100644 new mode 100755 diff --git a/input/migrations/0034_auto_20201102_0913.py b/input/migrations/0034_auto_20201102_0913.py old mode 100644 new mode 100755 diff --git a/input/migrations/0035_auto_20201102_0944.py b/input/migrations/0035_auto_20201102_0944.py old mode 100644 new mode 100755 diff --git a/input/migrations/0036_auto_20201102_1049.py b/input/migrations/0036_auto_20201102_1049.py old mode 100644 new mode 100755 diff --git a/input/migrations/0037_auto_20201102_1054.py b/input/migrations/0037_auto_20201102_1054.py old mode 100644 new mode 100755 diff --git a/input/migrations/0038_auto_20201102_1055.py b/input/migrations/0038_auto_20201102_1055.py old mode 100644 new mode 100755 diff --git a/input/migrations/0039_auto_20201102_1212.py b/input/migrations/0039_auto_20201102_1212.py old mode 100644 new mode 100755 diff --git a/input/migrations/0040_auto_20201102_1302.py b/input/migrations/0040_auto_20201102_1302.py old mode 100644 new mode 100755 diff --git a/input/migrations/0041_auto_20201102_1318.py b/input/migrations/0041_auto_20201102_1318.py old mode 100644 new mode 100755 diff --git a/input/migrations/0042_auto_20201102_1319.py b/input/migrations/0042_auto_20201102_1319.py old mode 100644 new mode 100755 diff --git a/input/migrations/0043_auto_20201102_1320.py b/input/migrations/0043_auto_20201102_1320.py old mode 100644 new mode 100755 diff --git a/input/migrations/0044_auto_20201103_1545.py b/input/migrations/0044_auto_20201103_1545.py old mode 100644 new mode 100755 diff --git a/input/migrations/0044_auto_20201116_1531.py b/input/migrations/0044_auto_20201116_1531.py old mode 100644 new mode 100755 diff --git a/input/migrations/0045_auto_20201116_1557.py b/input/migrations/0045_auto_20201116_1557.py old mode 100644 new mode 100755 diff --git a/input/migrations/0046_auto_20201117_1542.py b/input/migrations/0046_auto_20201117_1542.py old mode 100644 new mode 100755 diff --git a/input/migrations/0047_auto_20201117_1546.py b/input/migrations/0047_auto_20201117_1546.py old mode 100644 new mode 100755 diff --git a/input/migrations/0048_auto_20201118_1503.py b/input/migrations/0048_auto_20201118_1503.py old mode 100644 new mode 100755 diff --git a/input/migrations/0049_auto_20201118_1509.py b/input/migrations/0049_auto_20201118_1509.py old mode 100644 new mode 100755 diff --git a/input/migrations/0050_auto_20201118_1512.py b/input/migrations/0050_auto_20201118_1512.py old mode 100644 new mode 100755 diff --git a/input/migrations/0051_auto_20201118_1521.py b/input/migrations/0051_auto_20201118_1521.py old mode 100644 new mode 100755 diff --git a/input/migrations/0052_auto_20201118_1524.py b/input/migrations/0052_auto_20201118_1524.py old mode 100644 new mode 100755 diff --git a/input/migrations/0053_auto_20201118_1531.py b/input/migrations/0053_auto_20201118_1531.py old mode 100644 new mode 100755 diff --git a/input/migrations/0054_auto_20201118_1702.py b/input/migrations/0054_auto_20201118_1702.py old mode 100644 new mode 100755 diff --git a/input/migrations/0055_merge_20201118_1734.py b/input/migrations/0055_merge_20201118_1734.py old mode 100644 new mode 100755 diff --git a/input/migrations/0056_auto_20201217_1215.py b/input/migrations/0056_auto_20201217_1215.py old mode 100644 new mode 100755 diff --git a/input/migrations/0057_auto_20210104_0937.py b/input/migrations/0057_auto_20210104_0937.py old mode 100644 new mode 100755 diff --git a/input/migrations/0058_auto_20210412_0946.py b/input/migrations/0058_auto_20210412_0946.py old mode 100644 new mode 100755 diff --git a/input/migrations/0059_auto_20210412_1142.py b/input/migrations/0059_auto_20210412_1142.py old mode 100644 new mode 100755 diff --git a/input/migrations/0060_concreteextern.py b/input/migrations/0060_concreteextern.py old mode 100644 new mode 100755 diff --git a/input/migrations/0061_concretevolunteer.py b/input/migrations/0061_concretevolunteer.py old mode 100644 new mode 100755 diff --git a/input/migrations/0062_auto_20211103_1155.py b/input/migrations/0062_auto_20211103_1155.py old mode 100644 new mode 100755 diff --git a/input/migrations/0063_businesscard_url_of_pic_alter_ifg_notes_and_more.py b/input/migrations/0063_businesscard_url_of_pic_alter_ifg_notes_and_more.py old mode 100644 new mode 100755 diff --git a/input/migrations/0064_businesscard_send_data_to_print_literature_selfbuy_and_more.py b/input/migrations/0064_businesscard_send_data_to_print_literature_selfbuy_and_more.py old mode 100644 new mode 100755 diff --git a/input/migrations/0065_alter_literature_selfbuy_and_more.py b/input/migrations/0065_alter_literature_selfbuy_and_more.py old mode 100644 new mode 100755 diff --git a/input/migrations/0066_email_adult.py b/input/migrations/0066_email_adult.py old mode 100644 new mode 100755 diff --git a/input/migrations/0067_travel_project_name_alter_library_type.py b/input/migrations/0067_travel_project_name_alter_library_type.py old mode 100644 new mode 100755 diff --git a/input/migrations/0068_travel_hotel.py b/input/migrations/0068_travel_hotel.py old mode 100644 new mode 100755 diff --git a/input/migrations/0069_alter_travel_transport.py b/input/migrations/0069_alter_travel_transport.py old mode 100644 new mode 100755 diff --git a/input/migrations/0070_alter_travel_project.py b/input/migrations/0070_alter_travel_project.py old mode 100644 new mode 100755 diff --git a/input/migrations/0071_honorarycertificate_intern_notes_travel_intern_notes.py b/input/migrations/0071_honorarycertificate_intern_notes_travel_intern_notes.py old mode 100644 new mode 100755 diff --git a/input/migrations/0072_businesscard_intern_notes_email_intern_notes_and_more.py b/input/migrations/0072_businesscard_intern_notes_email_intern_notes_and_more.py old mode 100644 new mode 100755 diff --git a/input/migrations/0073_account_intern_notes.py b/input/migrations/0073_account_intern_notes.py old mode 100644 new mode 100755 diff --git a/input/migrations/0074_project_intern_notes.py b/input/migrations/0074_project_intern_notes.py old mode 100644 new mode 100755 diff --git a/input/migrations/0075_literature_selfbuy_data.py b/input/migrations/0075_literature_selfbuy_data.py old mode 100644 new mode 100755 diff --git a/input/migrations/0076_auto_20221129_1601.py b/input/migrations/0076_auto_20221129_1601.py new file mode 100644 index 0000000..988c42e --- /dev/null +++ b/input/migrations/0076_auto_20221129_1601.py @@ -0,0 +1,78 @@ +# Generated by Django 3.1.2 on 2022-11-29 16:01 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('input', '0075_literature_selfbuy_data'), + ] + + operations = [ + migrations.AlterField( + model_name='businesscard', + name='survey_mail_send', + field=models.BooleanField(default=True, verbose_name='Keine Umfragemail schicken'), + ), + migrations.AlterField( + model_name='concreteextern', + name='survey_mail_send', + field=models.BooleanField(default=True, verbose_name='Keine Umfragemail schicken'), + ), + migrations.AlterField( + model_name='concretevolunteer', + name='survey_mail_send', + field=models.BooleanField(default=True, verbose_name='Keine Umfragemail schicken'), + ), + migrations.AlterField( + model_name='email', + name='survey_mail_send', + field=models.BooleanField(default=True, verbose_name='Keine Umfragemail schicken'), + ), + migrations.AlterField( + model_name='honorarycertificate', + name='survey_mail_send', + field=models.BooleanField(default=True, verbose_name='Keine Umfragemail schicken'), + ), + migrations.AlterField( + model_name='ifg', + name='survey_mail_send', + field=models.BooleanField(default=True, verbose_name='Keine Umfragemail schicken'), + ), + migrations.AlterField( + model_name='library', + name='survey_mail_send', + field=models.BooleanField(default=True, verbose_name='Keine Umfragemail schicken'), + ), + migrations.AlterField( + model_name='list', + name='survey_mail_send', + field=models.BooleanField(default=True, verbose_name='Keine Umfragemail schicken'), + ), + migrations.AlterField( + model_name='literature', + name='selfbuy_data', + field=models.TextField(default='', help_text='Bitte gib hier alle persönlichen Daten an, die wir benötigen, um das Werk
für dich zu kaufen und es dir anschließend zu schicken (z.B. Vorname Nachname, Anschrift,
Telefonnummer, E-Mail-Adresse usw.). Trenne die einzelnen Angaben durch Zeilenumbrüche.
Hinweis: Telefonnummern bilden wir üblicherweise im internationalen Format gemäß
DIN 5008 ab. Als anzugebende E-Mail-Adresse empfehlen wir dir eine Wikimedia-Projekt-
Adresse, die du ebenfalls beantragen kannst, sofern du nicht bereits eine besitzt.', max_length=1000, verbose_name='Persönliche Daten sowie Adresse'), + ), + migrations.AlterField( + model_name='literature', + name='selfbuy_give_data', + field=models.BooleanField(help_text='Weitergabe meiner Daten (Name, Postadresse) an den von mir angegebenen Anbieter/Dienstleister.', verbose_name='Datenweitergabe erlauben'), + ), + migrations.AlterField( + model_name='literature', + name='survey_mail_send', + field=models.BooleanField(default=True, verbose_name='Keine Umfragemail schicken'), + ), + migrations.AlterField( + model_name='project', + name='survey_mail_send', + field=models.BooleanField(default=True, verbose_name='Keine Umfragemail schicken'), + ), + migrations.AlterField( + model_name='travel', + name='survey_mail_send', + field=models.BooleanField(default=True, verbose_name='Keine Umfragemail schicken'), + ), + ] diff --git a/input/migrations/0077_auto_20221129_1706.py b/input/migrations/0077_auto_20221129_1706.py new file mode 100644 index 0000000..e59dba8 --- /dev/null +++ b/input/migrations/0077_auto_20221129_1706.py @@ -0,0 +1,123 @@ +# Generated by Django 3.1.2 on 2022-11-29 17:06 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('input', '0076_auto_20221129_1601'), + ] + + operations = [ + migrations.AddField( + model_name='businesscard', + name='mailState', + field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('SURVEY', 'die Survey Mail wurde bereits versendet'), ('END', 'alle automatischen Mails wurden bereits versendet')], default='END', max_length=6), + ), + migrations.AddField( + model_name='concreteextern', + name='mailState', + field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('SURVEY', 'die Survey Mail wurde bereits versendet'), ('END', 'alle automatischen Mails wurden bereits versendet')], default='END', max_length=6), + ), + migrations.AddField( + model_name='concretevolunteer', + name='mailState', + field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('SURVEY', 'die Survey Mail wurde bereits versendet'), ('END', 'alle automatischen Mails wurden bereits versendet')], default='END', max_length=6), + ), + migrations.AddField( + model_name='email', + name='mailState', + field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('SURVEY', 'die Survey Mail wurde bereits versendet'), ('END', 'alle automatischen Mails wurden bereits versendet')], default='END', max_length=6), + ), + migrations.AddField( + model_name='honorarycertificate', + name='mailState', + field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('SURVEY', 'die Survey Mail wurde bereits versendet'), ('END', 'alle automatischen Mails wurden bereits versendet')], default='END', max_length=6), + ), + migrations.AddField( + model_name='ifg', + name='mailState', + field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('SURVEY', 'die Survey Mail wurde bereits versendet'), ('END', 'alle automatischen Mails wurden bereits versendet')], default='END', max_length=6), + ), + migrations.AddField( + model_name='library', + name='mailState', + field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('SURVEY', 'die Survey Mail wurde bereits versendet'), ('END', 'alle automatischen Mails wurden bereits versendet')], default='END', max_length=6), + ), + migrations.AddField( + model_name='list', + name='mailState', + field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('SURVEY', 'die Survey Mail wurde bereits versendet'), ('END', 'alle automatischen Mails wurden bereits versendet')], default='END', max_length=6), + ), + migrations.AddField( + model_name='literature', + name='mailState', + field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('SURVEY', 'die Survey Mail wurde bereits versendet'), ('END', 'alle automatischen Mails wurden bereits versendet')], default='END', max_length=6), + ), + migrations.AddField( + model_name='project', + name='mailState', + field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('SURVEY', 'die Survey Mail wurde bereits versendet'), ('END', 'alle automatischen Mails wurden bereits versendet')], default='END', max_length=6), + ), + migrations.AddField( + model_name='travel', + name='mailState', + field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('SURVEY', 'die Survey Mail wurde bereits versendet'), ('END', 'alle automatischen Mails wurden bereits versendet')], default='END', max_length=6), + ), + migrations.AlterField( + model_name='businesscard', + name='survey_mail_send', + field=models.BooleanField(default=False, verbose_name='Keine Umfragemail schicken'), + ), + migrations.AlterField( + model_name='concreteextern', + name='survey_mail_send', + field=models.BooleanField(default=False, verbose_name='Keine Umfragemail schicken'), + ), + migrations.AlterField( + model_name='concretevolunteer', + name='survey_mail_send', + field=models.BooleanField(default=False, verbose_name='Keine Umfragemail schicken'), + ), + migrations.AlterField( + model_name='email', + name='survey_mail_send', + field=models.BooleanField(default=False, verbose_name='Keine Umfragemail schicken'), + ), + migrations.AlterField( + model_name='honorarycertificate', + name='survey_mail_send', + field=models.BooleanField(default=False, verbose_name='Keine Umfragemail schicken'), + ), + migrations.AlterField( + model_name='ifg', + name='survey_mail_send', + field=models.BooleanField(default=False, verbose_name='Keine Umfragemail schicken'), + ), + migrations.AlterField( + model_name='library', + name='survey_mail_send', + field=models.BooleanField(default=False, verbose_name='Keine Umfragemail schicken'), + ), + migrations.AlterField( + model_name='list', + name='survey_mail_send', + field=models.BooleanField(default=False, verbose_name='Keine Umfragemail schicken'), + ), + migrations.AlterField( + model_name='literature', + name='survey_mail_send', + field=models.BooleanField(default=False, verbose_name='Keine Umfragemail schicken'), + ), + migrations.AlterField( + model_name='project', + name='survey_mail_send', + field=models.BooleanField(default=False, verbose_name='Keine Umfragemail schicken'), + ), + migrations.AlterField( + model_name='travel', + name='survey_mail_send', + field=models.BooleanField(default=False, verbose_name='Keine Umfragemail schicken'), + ), + ] diff --git a/input/migrations/0078_auto_20221129_1712.py b/input/migrations/0078_auto_20221129_1712.py new file mode 100644 index 0000000..f4520f4 --- /dev/null +++ b/input/migrations/0078_auto_20221129_1712.py @@ -0,0 +1,68 @@ +# Generated by Django 3.1.2 on 2022-11-29 17:12 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('input', '0077_auto_20221129_1706'), + ] + + operations = [ + migrations.RenameField( + model_name='businesscard', + old_name='mailState', + new_name='mail_state', + ), + migrations.RenameField( + model_name='concreteextern', + old_name='mailState', + new_name='mail_state', + ), + migrations.RenameField( + model_name='concretevolunteer', + old_name='mailState', + new_name='mail_state', + ), + migrations.RenameField( + model_name='email', + old_name='mailState', + new_name='mail_state', + ), + migrations.RenameField( + model_name='honorarycertificate', + old_name='mailState', + new_name='mail_state', + ), + migrations.RenameField( + model_name='ifg', + old_name='mailState', + new_name='mail_state', + ), + migrations.RenameField( + model_name='library', + old_name='mailState', + new_name='mail_state', + ), + migrations.RenameField( + model_name='list', + old_name='mailState', + new_name='mail_state', + ), + migrations.RenameField( + model_name='literature', + old_name='mailState', + new_name='mail_state', + ), + migrations.RenameField( + model_name='project', + old_name='mailState', + new_name='mail_state', + ), + migrations.RenameField( + model_name='travel', + old_name='mailState', + new_name='mail_state', + ), + ] diff --git a/input/migrations/0079_auto_20221129_2310.py b/input/migrations/0079_auto_20221129_2310.py new file mode 100644 index 0000000..9e7967b --- /dev/null +++ b/input/migrations/0079_auto_20221129_2310.py @@ -0,0 +1,68 @@ +# Generated by Django 3.1.2 on 2022-11-29 23:10 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('input', '0078_auto_20221129_1712'), + ] + + operations = [ + migrations.AlterField( + model_name='businesscard', + name='mail_state', + field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('END', 'die Benachrichtigung End-Mail wurde bereits versendet'), ('APPR', 'alle automatischen Mails, auch surveyMail, wurden bereits versendet')], default='APPR', max_length=6), + ), + migrations.AlterField( + model_name='concreteextern', + name='mail_state', + field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('END', 'die Benachrichtigung End-Mail wurde bereits versendet'), ('APPR', 'alle automatischen Mails, auch surveyMail, wurden bereits versendet')], default='APPR', max_length=6), + ), + migrations.AlterField( + model_name='concretevolunteer', + name='mail_state', + field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('END', 'die Benachrichtigung End-Mail wurde bereits versendet'), ('APPR', 'alle automatischen Mails, auch surveyMail, wurden bereits versendet')], default='APPR', max_length=6), + ), + migrations.AlterField( + model_name='email', + name='mail_state', + field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('END', 'die Benachrichtigung End-Mail wurde bereits versendet'), ('APPR', 'alle automatischen Mails, auch surveyMail, wurden bereits versendet')], default='APPR', max_length=6), + ), + migrations.AlterField( + model_name='honorarycertificate', + name='mail_state', + field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('END', 'die Benachrichtigung End-Mail wurde bereits versendet'), ('APPR', 'alle automatischen Mails, auch surveyMail, wurden bereits versendet')], default='APPR', max_length=6), + ), + migrations.AlterField( + model_name='ifg', + name='mail_state', + field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('END', 'die Benachrichtigung End-Mail wurde bereits versendet'), ('APPR', 'alle automatischen Mails, auch surveyMail, wurden bereits versendet')], default='APPR', max_length=6), + ), + migrations.AlterField( + model_name='library', + name='mail_state', + field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('END', 'die Benachrichtigung End-Mail wurde bereits versendet'), ('APPR', 'alle automatischen Mails, auch surveyMail, wurden bereits versendet')], default='APPR', max_length=6), + ), + migrations.AlterField( + model_name='list', + name='mail_state', + field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('END', 'die Benachrichtigung End-Mail wurde bereits versendet'), ('APPR', 'alle automatischen Mails, auch surveyMail, wurden bereits versendet')], default='APPR', max_length=6), + ), + migrations.AlterField( + model_name='literature', + name='mail_state', + field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('END', 'die Benachrichtigung End-Mail wurde bereits versendet'), ('APPR', 'alle automatischen Mails, auch surveyMail, wurden bereits versendet')], default='APPR', max_length=6), + ), + migrations.AlterField( + model_name='project', + name='mail_state', + field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('END', 'die Benachrichtigung End-Mail wurde bereits versendet'), ('APPR', 'alle automatischen Mails, auch surveyMail, wurden bereits versendet')], default='APPR', max_length=6), + ), + migrations.AlterField( + model_name='travel', + name='mail_state', + field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('END', 'die Benachrichtigung End-Mail wurde bereits versendet'), ('APPR', 'alle automatischen Mails, auch surveyMail, wurden bereits versendet')], default='APPR', max_length=6), + ), + ] diff --git a/input/migrations/0080_auto_20221129_2323.py b/input/migrations/0080_auto_20221129_2323.py new file mode 100644 index 0000000..2ed8741 --- /dev/null +++ b/input/migrations/0080_auto_20221129_2323.py @@ -0,0 +1,68 @@ +# Generated by Django 3.1.2 on 2022-11-29 23:23 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('input', '0079_auto_20221129_2310'), + ] + + operations = [ + migrations.AlterField( + model_name='businesscard', + name='mail_state', + field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('INF', 'die Benachrichtigung End-Mail wurde bereits versendet'), ('END', 'alle automatischen Mails, auch surveyMail, wurden bereits versendet')], default='NONE', max_length=6), + ), + migrations.AlterField( + model_name='concreteextern', + name='mail_state', + field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('INF', 'die Benachrichtigung End-Mail wurde bereits versendet'), ('END', 'alle automatischen Mails, auch surveyMail, wurden bereits versendet')], default='NONE', max_length=6), + ), + migrations.AlterField( + model_name='concretevolunteer', + name='mail_state', + field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('INF', 'die Benachrichtigung End-Mail wurde bereits versendet'), ('END', 'alle automatischen Mails, auch surveyMail, wurden bereits versendet')], default='NONE', max_length=6), + ), + migrations.AlterField( + model_name='email', + name='mail_state', + field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('INF', 'die Benachrichtigung End-Mail wurde bereits versendet'), ('END', 'alle automatischen Mails, auch surveyMail, wurden bereits versendet')], default='NONE', max_length=6), + ), + migrations.AlterField( + model_name='honorarycertificate', + name='mail_state', + field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('INF', 'die Benachrichtigung End-Mail wurde bereits versendet'), ('END', 'alle automatischen Mails, auch surveyMail, wurden bereits versendet')], default='NONE', max_length=6), + ), + migrations.AlterField( + model_name='ifg', + name='mail_state', + field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('INF', 'die Benachrichtigung End-Mail wurde bereits versendet'), ('END', 'alle automatischen Mails, auch surveyMail, wurden bereits versendet')], default='NONE', max_length=6), + ), + migrations.AlterField( + model_name='library', + name='mail_state', + field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('INF', 'die Benachrichtigung End-Mail wurde bereits versendet'), ('END', 'alle automatischen Mails, auch surveyMail, wurden bereits versendet')], default='NONE', max_length=6), + ), + migrations.AlterField( + model_name='list', + name='mail_state', + field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('INF', 'die Benachrichtigung End-Mail wurde bereits versendet'), ('END', 'alle automatischen Mails, auch surveyMail, wurden bereits versendet')], default='NONE', max_length=6), + ), + migrations.AlterField( + model_name='literature', + name='mail_state', + field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('INF', 'die Benachrichtigung End-Mail wurde bereits versendet'), ('END', 'alle automatischen Mails, auch surveyMail, wurden bereits versendet')], default='NONE', max_length=6), + ), + migrations.AlterField( + model_name='project', + name='mail_state', + field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('INF', 'die Benachrichtigung End-Mail wurde bereits versendet'), ('END', 'alle automatischen Mails, auch surveyMail, wurden bereits versendet')], default='NONE', max_length=6), + ), + migrations.AlterField( + model_name='travel', + name='mail_state', + field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('INF', 'die Benachrichtigung End-Mail wurde bereits versendet'), ('END', 'alle automatischen Mails, auch surveyMail, wurden bereits versendet')], default='NONE', max_length=6), + ), + ] diff --git a/input/migrations/__init__.py b/input/migrations/__init__.py old mode 100644 new mode 100755 diff --git a/input/models.py b/input/models.py old mode 100644 new mode 100755 index b1b4f83..f5ced02 --- a/input/models.py +++ b/input/models.py @@ -6,6 +6,10 @@ from django.utils.html import format_html from .settings import ACCOUNTS +EMAIL_STATES = {'NONE': 'noch keine Mail versendet', + 'INF': 'die Benachrichtigung End-Mail wurde bereits versendet', + 'END': 'alle automatischen Mails, auch surveyMail, wurden bereits versendet'} + class Volunteer(models.Model): realname = models.CharField(max_length=200, null=True, verbose_name="Realname", help_text="Bitte gib deinen Vornamen und deinen Nachnamen ein.") @@ -17,6 +21,8 @@ class Volunteer(models.Model): granted_date = models.DateField(null=True) survey_mail_send = models.BooleanField(default=False, verbose_name='Keine Umfragemail schicken') survey_mail_date = models.DateField(verbose_name='Umfragemail wurde verschickt am', null=True, blank=True) + mail_state = models.CharField(max_length=6, choices=EMAIL_STATES.items(), default='NONE') + @classmethod def set_granted(cl, key, b): diff --git a/input/settings.py b/input/settings.py old mode 100644 new mode 100755 diff --git a/input/static/dropdown/js/base.js b/input/static/dropdown/js/base.js old mode 100644 new mode 100755 diff --git a/input/static/input/logo.png b/input/static/input/logo.png old mode 100644 new mode 100755 diff --git a/input/static/input/nutzungsbedingungen.html b/input/static/input/nutzungsbedingungen.html old mode 100644 new mode 100755 diff --git a/input/templates/input/extern.html b/input/templates/input/extern.html old mode 100644 new mode 100755 diff --git a/input/templates/input/if_end_of_project.html b/input/templates/input/if_end_of_project.html old mode 100644 new mode 100755 diff --git a/input/templates/input/if_end_of_project.txt b/input/templates/input/if_end_of_project.txt old mode 100644 new mode 100755 diff --git a/input/templates/input/if_end_of_project_approved.html b/input/templates/input/if_end_of_project_approved.html old mode 100644 new mode 100755 diff --git a/input/templates/input/if_end_of_project_approved.txt b/input/templates/input/if_end_of_project_approved.txt old mode 100644 new mode 100755 diff --git a/input/templates/input/if_end_of_project_orginformed.html b/input/templates/input/if_end_of_project_orginformed.html old mode 100644 new mode 100755 diff --git a/input/templates/input/if_end_of_project_orginformed.txt b/input/templates/input/if_end_of_project_orginformed.txt old mode 100644 new mode 100755 diff --git a/input/templates/input/if_mail.html b/input/templates/input/if_mail.html old mode 100644 new mode 100755 diff --git a/input/templates/input/if_mail.txt b/input/templates/input/if_mail.txt old mode 100644 new mode 100755 diff --git a/input/templates/input/if_not_of_project_approved.html b/input/templates/input/if_not_of_project_approved.html old mode 100644 new mode 100755 diff --git a/input/templates/input/if_not_of_project_approved.txt b/input/templates/input/if_not_of_project_approved.txt old mode 100644 new mode 100755 diff --git a/input/templates/input/ifg_volunteer_mail.html b/input/templates/input/ifg_volunteer_mail.html old mode 100644 new mode 100755 diff --git a/input/templates/input/ifg_volunteer_mail.txt b/input/templates/input/ifg_volunteer_mail.txt old mode 100644 new mode 100755 diff --git a/input/templates/input/survey_mail.html b/input/templates/input/survey_mail.html old mode 100644 new mode 100755 diff --git a/input/templates/input/survey_mail.txt b/input/templates/input/survey_mail.txt old mode 100644 new mode 100755 diff --git a/input/templates/registration/login.html b/input/templates/registration/login.html old mode 100644 new mode 100755 diff --git a/input/tests.py b/input/tests.py old mode 100644 new mode 100755 diff --git a/input/urls.py b/input/urls.py old mode 100644 new mode 100755 diff --git a/input/views.py b/input/views.py old mode 100644 new mode 100755 index 4a257dd..9f48e10 --- a/input/views.py +++ b/input/views.py @@ -249,8 +249,8 @@ class ExternView(CookieWizardView): html_content = html_mail_template.render(context) msg = EmailMultiAlternatives(subject, text_content, from_email, [to]) msg.attach_alternative(html_content, "text/html") - msg.send() - + #msg.send() + print('ifg volunteer mail would have been sent') #send_mail( # 'Formular ausgefüllt', # mail_template.render(context), @@ -267,8 +267,8 @@ class ExternView(CookieWizardView): html_content = html_mail_template.render(context) msg = EmailMultiAlternatives(subject, text_content, from_email, [to]) msg.attach_alternative(html_content, "text/html") - msg.send() - + #msg.send() + print('if mail would have been sent') #send_mail( # 'Formular ausgefüllt', # mail_template.render(context), diff --git a/requirements.txt b/requirements.txt new file mode 100755 index 0000000..59966ae --- /dev/null +++ b/requirements.txt @@ -0,0 +1,7 @@ +asgiref==3.2.10 +Django==3.1.2 +django-formtools==2.4 +gunicorn==20.0.4 +mysqlclient==2.1.1 +sqlparse==0.4.3 +whitenoise==6.2.0