From 7382c4e4bfe10e19cb28777fd056ec8c36c92e28 Mon Sep 17 00:00:00 2001 From: Aarni Halinen Date: Thu, 13 Jan 2022 21:53:55 +0200 Subject: [PATCH 1/2] update send email uses --- kaehmy/views.py | 143 +++++++++++++++++--------------- locale/en/LC_MESSAGES/django.mo | Bin 16380 -> 16368 bytes locale/en/LC_MESSAGES/django.po | 120 +++++++++++++-------------- locale/fi/LC_MESSAGES/django.mo | Bin 16205 -> 16255 bytes locale/fi/LC_MESSAGES/django.po | 120 +++++++++++++-------------- ohlhafv/views.py | 60 ++++++-------- webapp/utils.py | 72 +++++++++------- 7 files changed, 263 insertions(+), 252 deletions(-) diff --git a/kaehmy/views.py b/kaehmy/views.py index 8e7ab29..9d46404 100644 --- a/kaehmy/views.py +++ b/kaehmy/views.py @@ -24,28 +24,38 @@ from webapp.utils import send_email def list_view(request, *args, **kwargs): """Kaehmy application list""" - role_filter = request.GET.get('role', None) - if role_filter is not None and str(role_filter) != '-1': - applications = Application.objects.filter(custom_roles__id=role_filter) | Application.objects.filter(preset_roles__id=role_filter) + role_filter = request.GET.get("role", None) + if role_filter is not None and str(role_filter) != "-1": + applications = Application.objects.filter( + custom_roles__id=role_filter + ) | Application.objects.filter(preset_roles__id=role_filter) else: applications = Application.objects.all() - applications = applications.order_by('-timestamp') - filter_options_preset = PresetRole.objects.annotate(form_count=Count('forms')).filter(form_count__gt=0) - filter_options_preset_list = [(r.id, r.name, r.form_count) for r in filter_options_preset] - filter_options_custom = CustomRole.objects.annotate(form_count=Count('forms')).filter(form_count__gt=0) - filter_options_custom_list = [(r.id, r.name, r.form_count) for r in filter_options_custom] + applications = applications.order_by("-timestamp") + filter_options_preset = PresetRole.objects.annotate( + form_count=Count("forms") + ).filter(form_count__gt=0) + filter_options_preset_list = [ + (r.id, r.name, r.form_count) for r in filter_options_preset + ] + filter_options_custom = CustomRole.objects.annotate( + form_count=Count("forms") + ).filter(form_count__gt=0) + filter_options_custom_list = [ + (r.id, r.name, r.form_count) for r in filter_options_custom + ] filter_options = filter_options_preset_list + filter_options_custom_list filter_options.sort(key=lambda f: f[1]) context = { - 'applications': applications, - 'application_count': len(applications), - 'filter_options': filter_options + "applications": applications, + "application_count": len(applications), + "filter_options": filter_options, } - return render(request, 'kaehmy:list.html', context) + return render(request, "kaehmy:list.html", context) @ensure_csrf_cookie @@ -56,23 +66,21 @@ def comment(request, *args, **kwargs): form = CommentForm(request.POST) if form.is_valid(): comment = form.save() - email = comment.parent.email name = comment.name - subject = 'Kaehmyysi tai kommenttiisi on vastattu!' - body = (f'{name.capitalize()} on vastannut kaehmyhakemukseesi tai kommenttiisi kaehmypalvelussa.\r\n\r\n' - 'Käy lukemassa viesti osoitteessa https://{URL}/kaehmy') + to_email = comment.parent.email + subject = "Kaehmyysi tai kommenttiisi on vastattu!" + email_body = ( + f"{name.capitalize()} on vastannut kaehmyhakemukseesi tai kommenttiisi kaehmypalvelussa.\r\n\r\n" + "Käy lukemassa viesti osoitteessa https://{URL}/kaehmy" + ) + send_email(to=to_email, subject=subject, body=email_body) + logging.debug(f"Sent kaehmy comment email to recipient <{to_email}>") - send_email(email, subject, body) - logging.debug( - f'Sent kaehmy comment email to recipient <{email}>') - - return redirect('/kaehmy') + return redirect("/kaehmy") else: - context = { - 'error': form.errors - } - return render(request, 'kaehmy:error.html', context) + context = {"error": form.errors} + return render(request, "kaehmy:error.html", context) @require_http_methods(["GET"]) @@ -87,24 +95,24 @@ def statistics_view(request, *args, **kwargs): for preset in preset_roles: people = [form.name for form in preset.forms.all()] - role_list.append((preset.name, len(people), ', '.join(people))) + role_list.append((preset.name, len(people), ", ".join(people))) for custom in custom_roles: people = [form.name for form in custom.forms.all()] - role_list.append((custom.name, len(people), ', '.join(people))) + role_list.append((custom.name, len(people), ", ".join(people))) context = { - 'applications': applications, - 'application_count': len(applications), - 'role_list': role_list + "applications": applications, + "application_count": len(applications), + "role_list": role_list, } - return render(request, 'kaehmy:statistics.html', context) + return render(request, "kaehmy:statistics.html", context) @require_http_methods(["GET"]) def view(request, *args, **kwargs): """Render Kaehmy form page.""" form = ApplicationForm() - return render(request, 'kaehmy:kaehmy.html', {'form': form}) + return render(request, "kaehmy:kaehmy.html", {"form": form}) @ensure_csrf_cookie @@ -114,56 +122,59 @@ def submit(request, *args, **kwargs): form = ApplicationForm(request.POST) if form.is_valid(): application = form.save() - custom_name = form.cleaned_data.get('custom_role_name') - custom_is_board = form.cleaned_data.get('custom_role_is_board') + custom_name = form.cleaned_data.get("custom_role_name") + custom_is_board = form.cleaned_data.get("custom_role_is_board") if len(custom_name) > 0: - custom_role = CustomRole( - name=custom_name, is_board=custom_is_board) + custom_role = CustomRole(name=custom_name, is_board=custom_is_board) custom_role.save() application.custom_roles.add(custom_role) - url = f'https://{URL}/kaehmy' + url = f"https://{URL}/kaehmy" + name = form.cleaned_data.get("name", "Anonymous") + email_body = ( + f"Moikka {name}!\r\n\r\nHienoa, että kilta kiinnostaa! Kaehmysi on vastaanotettu.\r\n" + "Mahdollisista kommenteista tulee ilmoitus sähköpostitse.\r\n\r\n" + "Käy katsomassa kaehmytilanne osoitteessa {url}" + ) - email = form.cleaned_data.get('email', '') - name = form.cleaned_data.get('name', 'Anonymous') - subject = 'Arwokas kirjattu kirje mahdolliselle tulewalle kiltahenkilölle' - body = ('Moikka {}!\r\n\r\nHienoa, että kilta kiinnostaa! Kaehmysi on vastaanotettu.\r\n' - 'Mahdollisista kommenteista tulee ilmoitus sähköpostitse.\r\n\r\n' - 'Käy katsomassa kaehmytilanne osoitteessa {}').format(name, url) + to_email = form.cleaned_data.get("email", "") + subject = "Arwokas kirjattu kirje mahdolliselle tulewalle kiltahenkilölle" - send_email(email, subject, body) - logging.debug('Sent kaehmy email to recipient <{}>'.format(email)) + send_email(to_email, subject, email_body) + logging.debug(f"Sent kaehmy email to recipient <{to_email}>") CHAT_IDS = [channel.channel_id for channel in TelegramChannel.objects.all()] for chat_id in CHAT_IDS: - tg_string = 'https://api.telegram.org/bot{}/sendMessage?chat_id={}&text={}'.format( - settings.TELEGRAM_BOT_TOKEN, - chat_id, - 'Uusi New kaehmy! {} -> {}'.format(name, url) + tg_string = ( + "https://api.telegram.org/bot{}/sendMessage?chat_id={}&text={}".format( + settings.TELEGRAM_BOT_TOKEN, + chat_id, + "Uusi New kaehmy! {} -> {}".format(name, url), + ) ) response = requests.get(tg_string).json() - logging.debug('Telegram API response:\n{}'.format(response)) - logging.debug('Sent kaehmy announcement to {} channels.'.format(len(CHAT_IDS))) + logging.debug("Telegram API response:\n{}".format(response)) + logging.debug("Sent kaehmy announcement to {} channels.".format(len(CHAT_IDS))) else: - context = { - 'error': form.errors - } - return render(request, 'kaehmy:error.html', context) - return HttpResponseRedirect('/kaehmy') + context = {"error": form.errors} + return render(request, "kaehmy:error.html", context) + return HttpResponseRedirect("/kaehmy") -@require_http_methods(['GET']) -@login_required(login_url='/admin/login') +@require_http_methods(["GET"]) +@login_required(login_url="/admin/login") def export_view(request, *args, **kwargs): def make_table(queryset): - table = ExportTable(queryset, - request=request, - exclude=['id'], - attrs={'class': 'table table-bordered table-hover'}) + table = ExportTable( + queryset, + request=request, + exclude=["id"], + attrs={"class": "table table-bordered table-hover"}, + ) - table.paginate(page=request.GET.get('page', 1), per_page=9999) + table.paginate(page=request.GET.get("page", 1), per_page=9999) table_html = convert_table_to_html(table, request) return table_html @@ -172,7 +183,7 @@ def export_view(request, *args, **kwargs): board = filter(lambda q: q.has_any_board_role(), kaehmys) context = { - 'non_board_table': make_table(non_board), - 'board_table': make_table(board), + "non_board_table": make_table(non_board), + "board_table": make_table(board), } - return render(request, 'kaehmy:export.html', context) + return render(request, "kaehmy:export.html", context) diff --git a/locale/en/LC_MESSAGES/django.mo b/locale/en/LC_MESSAGES/django.mo index 6ccda0d96dd2c9feec5edbad6335b8861ddf5a79..d71fa824d321dcc5eb2b8b477e486f11b001e9ad 100644 GIT binary patch delta 4875 zcmZ|Qdwk9J9mnyn5D^5)K}aGFX(ST#NJ7=6E>-En%4pngX=pB|xw(Y8Z2OU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k0s7V{sG4;eOjbZQFlAtt@ziJ3ut*@WrAs5s%u+ zzSeA12J-Cnd~C1xe=-&A(Nuf{tFQ!*p|&P#q`MWPQK_4PTHzd225L|Xcpmkks>gKP zj(zb0W}wL-{m>6Ju}$bGHQTA^H19*D@&nWdSErtiV4JX zceS@r|1P0Lwh#rxY2r>Sf%p}nHMW)S*~&E3i>ExjV*6I&P@;;MM{qz|%Vz#wBvuh8i60X$6E6@dQ;7Fl zYaE|TRDM8cBhI;J&a@+d4r$ zg0o@PwqBt!fY44KBPJ1jh>v~Eouiy()P7E=6cP!%4vz}GO6zT+lsNBO z7oO&9ptg}1ON=5^J|j*MAE`lEK|D-cCbklf5&CRY5Go%M6NwYVSt5&QD@&>9#j3R( zmDotUPK?%9Xf+iN@gCt2_YsSUgG3UskoXPp3DH)jQ&~hDB2tMuUu{G;Z#A{~#4m|> z;#p!4@iXGrgvw!J2N9wMWfw7y2v>vBov0z!6M@7WBAHNm%lCCeveQg$d~2J}lvQlA z^-cJatzWS2!6I9qfic8u#1DxliMfQz7-Bb(Mw}tm5Otietosuojaselosteen ja tietojeni " "tallentamisen.\n" " " @@ -463,7 +459,7 @@ msgstr "" "of personal data.\n" " " -#: kaehmy/templates/kaehmy.html:84 members/templates/settings.html:23 +#: kaehmy/templates/kaehmy.html:83 members/templates/settings.html:23 msgid "Submit" msgstr "Submit" @@ -640,11 +636,11 @@ msgstr "Amazing! Your membership application has been sent." #: members/templates/application_success.html:9 msgid "" -"Vahvistusviesti on lähetetty sähköpostiisi. Ota yhteyttä admin@sahkoinsinoorikilta.fi." -"fi jos viestiä ei näy." +"Vahvistusviesti on lähetetty sähköpostiisi. Ota yhteyttä " +"admin@sahkoinsinoorikilta.fi jos viestiä ei näy." msgstr "" -"Confirmation email is sent to given email address. Contact admin@sahkoinsinoorikilta.fi." -"fi if you didn't receive it." +"Confirmation email is sent to given email address. Contact " +"admin@sahkoinsinoorikilta.fi.fi if you didn't receive it." #: members/templates/application_success.html:10 msgid "Takaisin Sähköinsinöörikillan web-sivuille" @@ -914,11 +910,11 @@ msgstr "Payments in register:" msgid "Language" msgstr "Language" -#: members/templates/settings.html:20 sikweb/base.py:217 +#: members/templates/settings.html:20 sikweb/base.py:216 msgid "Finnish" msgstr "Finnish" -#: members/templates/settings.html:21 sikweb/base.py:218 +#: members/templates/settings.html:21 sikweb/base.py:217 msgid "English" msgstr "English" @@ -1099,9 +1095,9 @@ msgstr "" msgid "Challenge" msgstr "Challenge" -#: ohlhafv/views.py:44 +#: ohlhafv/views.py:45 msgid "Sinut on haastettu Øhlhäfviin!" -msgstr "You have been challenged at Ohlhafv!" +msgstr "You have been challenged to Øhlhäfv!" #: templates/admin/base_site.html:44 msgid "Go" @@ -1153,11 +1149,11 @@ msgstr "" msgid "{}Event: {}" msgstr "" -#: webapp/models.py:91 +#: webapp/models.py:90 msgid "Template question" msgstr "" -#: webapp/models.py:92 +#: webapp/models.py:91 msgid "Template questions" msgstr "" diff --git a/locale/fi/LC_MESSAGES/django.mo b/locale/fi/LC_MESSAGES/django.mo index 219335dd3749cacf39e93cd2e7efc52fea2a36e2..8b2d5e69557603dec78c4b6bac875ef8ee7e111a 100644 GIT binary patch delta 2169 zcmaLYdrZ}39LMnowGPOEgIokc@ZjYL2SpSiAeC}TIdy`!#iorj^(0AY1#GnDuht(X zHP_Ti>z`U|+R{x$d!%AMj>7=Ppfft_Vl-CxUO_i?|Mh*lzJ>m_*!(!*Cm>;11MtJ8=jez+~*f z;dl(kBsg~lj}kvD_Mblxb)HLO;7HV;=sXT3?#B|mg^8F(5Wrki0)?20C1#B|7nRVP zn2vE9@4yi8=N4~AJ-4&Ob1s96gA5elNmN32u@DEa67wcHHw_ozE4UGr*fAWAr%(%A zL@j&=gZK<}KQPHpJRLPY%Hm>=3sq8%YWXZ2g>z90#4(QRP?h%~U3C4Z#FI+>3G=an zIEtF52~+TG3}YLP#&3|_c88GMoOji3Bv1AiEJ0;B4O8(o8?Q%I(ugB)mBsBihWJxV z#x4xuUQ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1N1H;*Y2Venk~}5%t{wYTR2@tiMk02pt`mTg}zOUr<|e7j;W;-iAu}0BZcB9t~xD67@m9#n(|U4xv`&1!}@Ttv^A`EHi7& z`KU^pP>C)@Rs5Z~5w#+lQS*5_tz$3hH(odDaGgg@_@_M|LM{C;s={Ze0o*KqZ?jNa zFcFn_t+@cl5ii9kevL|K3$kLK+d)Iut;_rwmEmEWipNmDxo#up)4fI|TEXw(7&c)X z+fZA%7j?}}qsD!Nxj2Fm49xMzk77{wKSo1KR*n@|gE|ANtiJ=bMct^%`cQ}TckBNP zHNibpWzVq*-{3NAio(x%<;%Ac4hdHGO47YLso|=s8tx`NB=tcd6--t-ksw5 bUWJ4C$%c5OFA-nyff~s~ye|26?xz0%5QpIa diff --git a/locale/fi/LC_MESSAGES/django.po b/locale/fi/LC_MESSAGES/django.po index cf602f6..e9cfe14 100644 --- a/locale/fi/LC_MESSAGES/django.po +++ b/locale/fi/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-01-18 21:36+0200\n" +"POT-Creation-Date: 2022-01-13 21:51+0200\n" "PO-Revision-Date: 2017-11-02 23:04+0200\n" "Last-Translator: \n" "Language-Team: \n" @@ -113,7 +113,7 @@ msgstr "Esikatsele" msgid "Delete" msgstr "Poista" -#: infoscreen/templates/tabs/add_remove.html:23 kaehmy/models.py:62 +#: infoscreen/templates/tabs/add_remove.html:23 kaehmy/models.py:57 #: kaehmy/templates/list.html:36 webapp/models.py:144 webapp/models.py:173 msgid "Name" msgstr "Nimi" @@ -190,7 +190,7 @@ msgstr "Puhelinnumero (ei julkinen)" msgid "Custom roles" msgstr "Uudet virat" -#: kaehmy/forms.py:49 kaehmy/templates/kaehmy.html:43 +#: kaehmy/forms.py:49 kaehmy/templates/kaehmy.html:42 msgid "Preset roles" msgstr "Kaehmyvirat" @@ -202,153 +202,153 @@ msgstr "Virheellinen puhelinnumero" msgid "Custom role with the same name already exists." msgstr "Samanniminen virka on jo olemassa." -#: kaehmy/models.py:18 +#: kaehmy/models.py:13 msgid "Kaehmy" msgstr "Kaehmy" -#: kaehmy/models.py:25 +#: kaehmy/models.py:20 msgid "Corporate affairs" msgstr "Yrityssuhteet" -#: kaehmy/models.py:26 webapp/templates/freshmen.html:10 +#: kaehmy/models.py:21 webapp/templates/freshmen.html:10 #: webapp/templates/navigation.html:8 msgid "Freshmen" msgstr "Fuksit" -#: kaehmy/models.py:27 webapp/templates/international.html:10 +#: kaehmy/models.py:22 webapp/templates/international.html:10 #: webapp/templates/navigation.html:14 msgid "International" msgstr "International" -#: kaehmy/models.py:28 +#: kaehmy/models.py:23 msgid "External affairs" msgstr "Ulkosuhteet" -#: kaehmy/models.py:29 +#: kaehmy/models.py:24 msgid "Media" msgstr "Media" -#: kaehmy/models.py:30 +#: kaehmy/models.py:25 msgid "Technology" msgstr "Teknologia" -#: kaehmy/models.py:31 +#: kaehmy/models.py:26 msgid "Wellbeing" msgstr "Hyvinvointi" -#: kaehmy/models.py:32 +#: kaehmy/models.py:27 msgid "Elepaja" msgstr "Elepaja" -#: kaehmy/models.py:33 +#: kaehmy/models.py:28 msgid "Ceremonies" msgstr "Hupitapahtumat" -#: kaehmy/models.py:34 +#: kaehmy/models.py:29 msgid "Studies" msgstr "Opinnot" -#: kaehmy/models.py:35 +#: kaehmy/models.py:30 msgid "Sössö magazine" msgstr "Kiltalehti Sössö" -#: kaehmy/models.py:36 +#: kaehmy/models.py:31 msgid "Alumni relations" msgstr "Alumnisuhteet" -#: kaehmy/models.py:37 +#: kaehmy/models.py:32 msgid "Others" msgstr "Muut" -#: kaehmy/models.py:39 +#: kaehmy/models.py:34 msgid "Category" msgstr "Kategoria" -#: kaehmy/models.py:45 +#: kaehmy/models.py:40 msgid "Description" msgstr "Kuvaus" -#: kaehmy/models.py:48 +#: kaehmy/models.py:43 msgid "Preset kaehmy role" msgstr "Kaehmyvirka" -#: kaehmy/models.py:49 +#: kaehmy/models.py:44 msgid "Preset kaehmy roles" msgstr "Kaehmyvirat" -#: kaehmy/models.py:56 +#: kaehmy/models.py:51 msgid "Custom kaehmy role" msgstr "Uusi virka" -#: kaehmy/models.py:57 +#: kaehmy/models.py:52 msgid "Custom kaehmy roles" msgstr "Uudet kaehmyvirat" -#: kaehmy/models.py:63 kaehmy/templates/list.html:40 members/models.py:14 +#: kaehmy/models.py:58 kaehmy/templates/list.html:40 members/models.py:14 msgid "Email" msgstr "Sähköposti" -#: kaehmy/models.py:64 +#: kaehmy/models.py:59 msgid "Timestamp" msgstr "Aikaleima" -#: kaehmy/models.py:78 +#: kaehmy/models.py:73 msgid "Kaehmykommentti" msgstr "Kaehmykommentti" -#: kaehmy/models.py:79 +#: kaehmy/models.py:74 msgid "Kaehmykommentit" msgstr "Kaehmykommentit" -#: kaehmy/models.py:81 ohlhafv/models.py:36 +#: kaehmy/models.py:76 ohlhafv/models.py:36 msgid "Message" msgstr "Viesti" -#: kaehmy/models.py:100 kaehmy/templates/kaehmy.html:12 +#: kaehmy/models.py:95 kaehmy/templates/kaehmy.html:12 msgid "Kaehmylomake" msgstr "Kaehmylomake" -#: kaehmy/models.py:101 +#: kaehmy/models.py:96 msgid "Kaehmylomakkeet" msgstr "Kaehmylomakkeet" -#: kaehmy/models.py:104 +#: kaehmy/models.py:99 msgid "Phone number" msgstr "Puhelinnumero" -#: kaehmy/models.py:105 +#: kaehmy/models.py:100 msgid "Year" msgstr "Vuosi" -#: kaehmy/models.py:106 +#: kaehmy/models.py:101 msgid "Text" msgstr "Teksti" -#: kaehmy/models.py:108 +#: kaehmy/models.py:103 msgid "Custom role name" msgstr "Uusi virka" -#: kaehmy/models.py:110 webapp/models.py:174 +#: kaehmy/models.py:105 webapp/models.py:174 msgid "Board member" msgstr "Hallituksen jäsen" -#: kaehmy/models.py:118 +#: kaehmy/models.py:113 msgid "Kaehmy application: {}" msgstr "Kaehmy: {}" -#: kaehmy/models.py:140 +#: kaehmy/models.py:135 msgid "Board: {}" msgstr "Hallitus: {}" -#: kaehmy/models.py:146 +#: kaehmy/models.py:141 msgid "Official: {}" msgstr "Toimari: {}" -#: kaehmy/models.py:163 +#: kaehmy/models.py:158 msgid "Telegram channel" msgstr "Telegram-kanava" -#: kaehmy/models.py:164 +#: kaehmy/models.py:159 msgid "Telegram channels" msgstr "Telegram-kanavat" @@ -404,8 +404,8 @@ msgstr "" " Koska lista ei ole koskaan täydellinen, voit myös ehdottaa ihan " "uutta toimenkuvaa.\n" " Jos sinulla on kysyttävää mistä tahansa virasta, kannattaa " -"konsultoida kaehmyopasta \n" +"konsultoida kaehmyopasta \n" " tai olla yhteydessä kyseistä virkaa tänä vuonna toimittavaan " "henkilöön." @@ -430,37 +430,33 @@ msgid "Päivämääriä & deadlineja" msgstr "Päivämääriä & deadlineja" #: kaehmy/templates/kaehmy.html:31 -msgid "Hallitustyrkkypaneeli" -msgstr "" +msgid "Vaalikokous, osa 1 (puheenjohtajan valinta) ja hallitustyrkkypaneeli" +msgstr "Vaalikokous, osa 1 (puheenjohtajan valinta) ja hallitustyrkkypaneeli" #: kaehmy/templates/kaehmy.html:32 -msgid "Vaalikokous, osa 1 (puheenjohtajan valinta)" -msgstr "Vaalikokous, osa 1 (puheenjohtajan valinta)" +msgid "Vaalikokous, osa 2 (hallituksen valinta)" +msgstr "Vaalikokous, osa 2 (hallituksen valinta)" #: kaehmy/templates/kaehmy.html:33 msgid "Toimikunta-appro" msgstr "" #: kaehmy/templates/kaehmy.html:34 -msgid "Vaalikokous, osa 2 (hallituksen valinta)" -msgstr "Vaalikokous, osa 2 (hallituksen valinta)" - -#: kaehmy/templates/kaehmy.html:35 msgid "Vaalikokous, osa 3 (toimarien valinta)" msgstr "Vaalikokous, osa 3 (toimarien valinta)" -#: kaehmy/templates/kaehmy.html:78 +#: kaehmy/templates/kaehmy.html:77 #, python-format msgid "" "\n" -" Hyväksyn tietosuojaselosteen ja tietojeni " +" Hyväksyn tietosuojaselosteen ja tietojeni " "tallentamisen.\n" " " msgstr "" -#: kaehmy/templates/kaehmy.html:84 members/templates/settings.html:23 +#: kaehmy/templates/kaehmy.html:83 members/templates/settings.html:23 msgid "Submit" msgstr "Lisää" @@ -637,8 +633,8 @@ msgstr "Hienoa! Jäsenhakemuksesi on nyt lähetetty." #: members/templates/application_success.html:9 msgid "" -"Vahvistusviesti on lähetetty sähköpostiisi. Ota yhteyttä admin@sahkoinsinoorikilta.fi." -"fi jos viestiä ei näy." +"Vahvistusviesti on lähetetty sähköpostiisi. Ota yhteyttä " +"admin@sahkoinsinoorikilta.fi jos viestiä ei näy." msgstr "" #: members/templates/application_success.html:10 @@ -905,11 +901,11 @@ msgstr "Maksutapahtumia:" msgid "Language" msgstr "Kieli" -#: members/templates/settings.html:20 sikweb/base.py:217 +#: members/templates/settings.html:20 sikweb/base.py:216 msgid "Finnish" msgstr "suomi" -#: members/templates/settings.html:21 sikweb/base.py:218 +#: members/templates/settings.html:21 sikweb/base.py:217 msgid "English" msgstr "englanti" @@ -1088,7 +1084,7 @@ msgstr "Haasta kaverisi mittelöön!" msgid "Challenge" msgstr "Haasta" -#: ohlhafv/views.py:44 +#: ohlhafv/views.py:45 msgid "Sinut on haastettu Øhlhäfviin!" msgstr "" @@ -1142,11 +1138,11 @@ msgstr "Tapahtuma" msgid "{}Event: {}" msgstr "{}Tapahtuma: {}" -#: webapp/models.py:91 +#: webapp/models.py:90 msgid "Template question" msgstr "Vakiokysymys" -#: webapp/models.py:92 +#: webapp/models.py:91 msgid "Template questions" msgstr "Vakiokysymykset" diff --git a/ohlhafv/views.py b/ohlhafv/views.py index 76067e0..596c5ac 100644 --- a/ohlhafv/views.py +++ b/ohlhafv/views.py @@ -1,33 +1,26 @@ """Ohlhafv views.""" -from django.db.models import Count -from django.shortcuts import render, redirect -from django.contrib.auth import login, logout, authenticate +import logging +from django.shortcuts import render from django.views.decorators.http import require_http_methods from django.views.decorators.csrf import ensure_csrf_cookie -from django.http import HttpResponse, HttpResponseRedirect -from django.contrib.auth.decorators import permission_required, login_required -from django.conf import settings +from django.http import HttpResponseRedirect from django.utils.translation import ugettext_lazy as _ from django.template.loader import render_to_string -import logging -import requests -from dealer.git import git -from sikweb.settings import URL from ohlhafv.models import OhlhafvChallenge from ohlhafv.forms import OhlhafvForm -from ohlhafv.tables import OhlhafvTable -from webapp.utils import send_email from kaehmy.tgbot import TelegramBot +from webapp.utils import send_email +from sikweb.settings import URL @require_http_methods(["GET"]) def ohlhafv_view(request, *args, **kwargs): """Render Ohlhafv form page.""" form = OhlhafvForm() - return render(request, 'ohlhafv:new.html', {'form': form}) + return render(request, "ohlhafv:new.html", {"form": form}) @ensure_csrf_cookie @@ -38,34 +31,33 @@ def ohlhafv_submit(request, *args, **kwargs): if form.is_valid(): form.save() challenge = form.instance - email = form.cleaned_data.get('victim_email', '') + url = f"https://{URL}/ohlhafv/list" - url = f'https://{URL}/ohlhafv/list' - subject = _('Sinut on haastettu Ohlhäfviin!') - - message = render_to_string( - 'ohlhafv:email.html', { - 'challenge': challenge, - 'url': url, - } + email_body = render_to_string( + "ohlhafv:email.html", + { + "challenge": challenge, + "url": url, + }, ) - send_email(email, subject, message) + + to_email = form.cleaned_data.get("victim_email", "") + subject = _("Sinut on haastettu Øhlhäfviin!") + send_email(to=to_email, subject=subject, body=email_body) + logging.debug(f"Sent ohlhafv email to recipient <{to_email}>") try: tg_message = render_to_string( - 'ohlhafv:tgmsg.tpl', { - 'challenge': challenge, - 'url': url}) + "ohlhafv:tgmsg.tpl", {"challenge": challenge, "url": url} + ) bot = TelegramBot() bot.broadcast(tg_message) - except Exception: # tg spam is not critical. Ignore on failure + except Exception: # tg spam is not critical. Ignore on failure pass - logging.debug( - 'Sent ohlhafv email to recipient <{}>'.format(email)) else: pass - return HttpResponseRedirect('/ohlhafv/list/') + return HttpResponseRedirect("/ohlhafv/list/") @ensure_csrf_cookie @@ -73,9 +65,9 @@ def ohlhafv_submit(request, *args, **kwargs): def ohlhafv_list(request, *args, **kwargs): """Present Ohlhafv challenges list.""" challenges = OhlhafvChallenge.objects.all() - challenges = challenges.order_by('-id') + challenges = challenges.order_by("-id") context = { - 'challenges': challenges, - 'challenge_count': len(challenges), + "challenges": challenges, + "challenge_count": len(challenges), } - return render(request, 'ohlhafv:list.html', context) + return render(request, "ohlhafv:list.html", context) diff --git a/webapp/utils.py b/webapp/utils.py index c311eba..c1f6dff 100644 --- a/webapp/utils.py +++ b/webapp/utils.py @@ -1,18 +1,30 @@ """Webapp utils.""" -from django.utils import timezone -import sendgrid -from sendgrid.helpers.mail import * - -from datetime import timedelta import logging -from django.template.loader import render_to_string -from django.core.files.base import ContentFile import base64 import uuid -from sikweb.settings import FRONTEND_URL, EMAIL_API_KEY, DEFAULT_EMAIL_FROM_ADDR, ENABLE_AUTOMATIC_EMAILS import imghdr import markdown +import sendgrid +from django.utils import timezone +from sendgrid.helpers.mail import ( + Email, + To, + Subject, + Mail, + HtmlContent, + PlainTextContent, +) +from django.template.loader import render_to_string +from django.core.files.base import ContentFile +from sikweb.settings import ( + FRONTEND_URL, + EMAIL_API_KEY, + DEFAULT_EMAIL_FROM, + DEFAULT_EMAIL_FROM_ADDR, + ENABLE_AUTOMATIC_EMAILS, +) +from datetime import timedelta def get_file_extension(file_name, decoded_file): @@ -25,15 +37,15 @@ def decode_base64_file(data): # Check if this is a base64 string if isinstance(data, str): # Check if the base64 string is in the "data:" format - if 'data:' in data and ';base64,' in data: + if "data:" in data and ";base64," in data: # Break out the header from the base64 content - header, data = data.split(';base64,') + header, data = data.split(";base64,") # Try to decode the file. Return validation error if it fails. try: decoded_file = base64.b64decode(data) except TypeError: - TypeError('invalid_image') + TypeError("invalid_image") # Generate file name: file_name = str(uuid.uuid4()) @@ -41,7 +53,10 @@ def decode_base64_file(data): # Get the file name extension: file_extension = get_file_extension(file_name, decoded_file) - complete_file_name = "%s.%s" % (file_name, file_extension, ) + complete_file_name = "%s.%s" % ( + file_name, + file_extension, + ) return ContentFile(decoded_file, name=complete_file_name) @@ -51,50 +66,51 @@ def month_from_now(): return timezone.now() + timedelta(days=30) -def send_email(to, subject, body, html=False): - if not ENABLE_AUTOMATIC_EMAILS: +def send_email(to: str, subject: str, body: str, html: bool = False): + if ENABLE_AUTOMATIC_EMAILS is False: logging.debug("Skipping email") logging.debug(f"to: {to}") logging.debug(f"subject: {subject}") logging.debug(f"body: {body}") return - from_email = DEFAULT_EMAIL_FROM_ADDR - to_email = to - sub = subject + from_email = Email(email=DEFAULT_EMAIL_FROM_ADDR, name=DEFAULT_EMAIL_FROM) + to_email = To(email=to) + sub = Subject(subject=subject) html_content = None plain_text_content = None - if (html): - html_content = HtmlContent(body) + if html: + html_content = HtmlContent(content=body) else: - plain_text_content = PlainTextContent(body) + plain_text_content = PlainTextContent(content=body) mail = Mail( from_email=from_email, to_emails=to_email, subject=sub, html_content=html_content, - plain_text_content=plain_text_content + plain_text_content=plain_text_content, ) try: - sg = sendgrid.SendGridAPIClient(EMAIL_API_KEY) + sg = sendgrid.SendGridAPIClient(api_key=EMAIL_API_KEY) response = sg.send(mail) if response.status_code != 202: - raise Exception(f'Failed to send email: {response.body}') + raise Exception(f"Failed to send email: {response.body}") except Exception as ex: - logging.exception('Failed to send email.') + logging.exception("Failed to send email.") def send_signup_email(to, subject, id, uuid, content): message = render_to_string( - 'webapp:signup_email.html', { - 'url': f"https://{FRONTEND_URL}/signup/edit/{id}/{uuid}", - 'content': markdown.markdown(content), - } + "webapp:signup_email.html", + { + "url": f"https://{FRONTEND_URL}/signup/edit/{id}/{uuid}", + "content": markdown.markdown(content), + }, ) return send_email(to, subject, message, True) From 1dc5d45e96e4d362e4a714ffdc66d4414f3a37f2 Mon Sep 17 00:00:00 2001 From: Aarni Halinen Date: Thu, 13 Jan 2022 21:55:54 +0200 Subject: [PATCH 2/2] Fix ohlhafv email --- locale/en/LC_MESSAGES/django.mo | Bin 16368 -> 16280 bytes locale/en/LC_MESSAGES/django.po | 6 +----- locale/fi/LC_MESSAGES/django.po | 6 +----- ohlhafv/views.py | 2 +- 4 files changed, 3 insertions(+), 11 deletions(-) diff --git a/locale/en/LC_MESSAGES/django.mo b/locale/en/LC_MESSAGES/django.mo index d71fa824d321dcc5eb2b8b477e486f11b001e9ad..37c486d7eef20c2d539c2c7874471339af64f158 100644 GIT binary patch delta 3976 zcmXxm4|L8|9LMqd*x1Cg=hT#XZLyCdw;*@-tYb1`~03=bv|;OQ&FMw z46l=v`jpTxV_N!*`OB|fW6Gn9xrY__E3S<;rWSr!$C%e}Db~b5j4|ODZ*7Djw9~LQ zHp4W`#Txjkcik}~sRZd5gOA`;)CXpxCMv-ImZI(}#|YeQuOG4fXRSA|A=hifdgCNx z3)(F)9fx8D&cRUQ7_*s*7P|vkq&bKR;Jod>j-j-DabAB7)QY3AKQ_PyI1WjknTI*} z3F^Ls7>OsbFUvvN3l&IR)cA>Y$-e@~vK<|fMVNe4{|MB86HytNf{kz%D&TKW0ac&^ z+K9@?R@7b}#v}}>=k=$e?#n}s*Qp-)Po&bzc8o&Kk9ivvVXhfpOa4T@ z0OmF-bAG-;N^unG^w-A+TY>FpCt-ISg382K4i%+v6>`qZcGR99w_d_9mUtJn1tA<1 zT@PY5CZJaIyzL)|8h8XIV-f0Xe2iMaE>wV3R_8bs{>(YvbV{oycoW2-CQPwrqgLDz zwI$D@GSnB<|0-(Yw@_Q~4w8LSj0$)KavaP?)aMT)nRCo3DjMiIDrKSUhXx8q?R5a> zV-_~YJ=g>9qEg$Ho3xibkzFt^pfXv6eACPf+g^g2xEyu1Hb2lYW*-%$<`io0|3F20 zAGI}cd}(D<)XMTundyxh@Fmpue;8_;s9zTNA2}%r~q!FCJf<-E3n$A`xC4ws6aB2WSKUog$+Rd%vj!>1S$)t zD0LfJV zA3-H7#oNO%sDUP<4&!XpUM)cl@D1wGxd!!MI)t6^G&aE`-Wc2T!jbqUD&TWi123Tt z>))sam{js#4gIOqG0593Y>Rg>tEu;^mzm~G7?JJ`To*Oqdl-(zSQ8hZR=x~1Q7Q6K zvley#8GHRAYN3}MDmuOYVQ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)@5#GXM- zd@brQH(-oXxr>4h-vQKvhujNc6GB@k-AzT@ z(!Sq45|JMB3HARz<0v!}O>SspysynojvU}?b#ISM3~Q%#C!s{1au-F8%KMDcapDM} z&r`%?;tbJ1Oef|ORfIn85mSiwiIeWN$e}rVC_P5x6OR&mi4;P|^;6upLpYzv7TVmEP&(C3i5!(ZY%==!6|d>=M0jM^HNSYBCE9jK}d%q}i|sJgVe zx+c)HdUnO^riNMb%F8SJG$tlj#imTJs^NxtrGc5HrImq_*~JwVrIlr+_XVn}{=Z%K MhWi@VjJOu`4@}U*6951J diff --git a/locale/en/LC_MESSAGES/django.po b/locale/en/LC_MESSAGES/django.po index a35757c..0ec571b 100644 --- a/locale/en/LC_MESSAGES/django.po +++ b/locale/en/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-01-13 21:51+0200\n" +"POT-Creation-Date: 2022-01-13 21:55+0200\n" "PO-Revision-Date: 2017-11-02 23:09+0200\n" "Last-Translator: \n" "Language-Team: \n" @@ -1095,10 +1095,6 @@ msgstr "" msgid "Challenge" msgstr "Challenge" -#: ohlhafv/views.py:45 -msgid "Sinut on haastettu Øhlhäfviin!" -msgstr "You have been challenged to Øhlhäfv!" - #: templates/admin/base_site.html:44 msgid "Go" msgstr "Go" diff --git a/locale/fi/LC_MESSAGES/django.po b/locale/fi/LC_MESSAGES/django.po index e9cfe14..8d7d45c 100644 --- a/locale/fi/LC_MESSAGES/django.po +++ b/locale/fi/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-01-13 21:51+0200\n" +"POT-Creation-Date: 2022-01-13 21:55+0200\n" "PO-Revision-Date: 2017-11-02 23:04+0200\n" "Last-Translator: \n" "Language-Team: \n" @@ -1084,10 +1084,6 @@ msgstr "Haasta kaverisi mittelöön!" msgid "Challenge" msgstr "Haasta" -#: ohlhafv/views.py:45 -msgid "Sinut on haastettu Øhlhäfviin!" -msgstr "" - #: templates/admin/base_site.html:44 msgid "Go" msgstr "Vaihda" diff --git a/ohlhafv/views.py b/ohlhafv/views.py index 596c5ac..81fcb3b 100644 --- a/ohlhafv/views.py +++ b/ohlhafv/views.py @@ -42,7 +42,7 @@ def ohlhafv_submit(request, *args, **kwargs): ) to_email = form.cleaned_data.get("victim_email", "") - subject = _("Sinut on haastettu Øhlhäfviin!") + subject = "Sinut on haastettu Øhlhäfviin!" send_email(to=to_email, subject=subject, body=email_body) logging.debug(f"Sent ohlhafv email to recipient <{to_email}>")