From 2ae6c6bc078cdc7ec6e3131bbbb430714bf36230 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Tue, 25 Jun 2013 12:05:17 +0200 Subject: [PATCH 1/1] crowdfunding: sending thank-you email --- apps/funding/locale/pl/LC_MESSAGES/django.mo | Bin 7385 -> 8120 bytes apps/funding/locale/pl/LC_MESSAGES/django.po | 101 ++++++++++++------- apps/funding/models.py | 14 +++ apps/funding/templates/funding/email.txt | 13 +++ 4 files changed, 94 insertions(+), 34 deletions(-) create mode 100644 apps/funding/templates/funding/email.txt diff --git a/apps/funding/locale/pl/LC_MESSAGES/django.mo b/apps/funding/locale/pl/LC_MESSAGES/django.mo index 2b31a6183d2a6010c2ce7e0427ac1008821712cd..e2cc7575618b1ec1d4687f1403e7e505579a32a3 100644 GIT binary patch delta 2386 zcmY+^du$X%9Ki8`9u!KUrR7x~IzSafTBxso|oyDIUB8L>EmzYUZMk=)j)1&yIEUs3n4%=`vcHvlDk5Sx#{Hag)nT}uK1pFRl zh-)|=f5%3=g%PY96Wmu+lelQ6VJ6B%T{s7~quk&lIjQGy8t%udcoO@hoos6G2F}A< zDEH5$Q6^f8lJF*M!CtJz=Wv25D)lNC((yP>#*-+Cd>(oMJ?cN=B-}Disbv_&DR>m8 zVj0OveS>sW-(ds(f*bHpoPjHuUH-odXEVQwaj^{taS2|=r8u5-+ktCQo@@wZ$QD&0?Yfw5g;KR58@4zg|mb`*@<5Ap<=kZ>wXO;x6#Ep0gx8eNT^Oi=Ko)jy;(>+LTn@MC!}zXx`&W~WE&nNq{!ZGA>{SF zUDk2Y9#$k#S#}mP_=-xiBrRLVk^6Uk`7(7At;7;S4jX4AIDDWs5pq7*_TYTX!~d2Q zVdbt+`EJOz%Hdudw#l+<;vquL5N}d3_{MLiB8P@Ep;i%6b`Tvz7tuz@7D(wKmJ)oc zf+FAg4TPMX`NRW+Y=e|Vge-ZBR48i**^*_1oRKjqOnWtz^#reJaEc)~6CwvWD9ib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UP zsNdx?oAr1Ui?Ih^;V`NuqLjYuMop*}mGUR348K4v-McZv<|7>n+l-(t_-Xx%GZ?#B z2faxEb>lUtHwvNFu*tgHoE{=Y$o9b|5!W_A~~1dmV; z>_?W~+0$#Vlvqb-J=N;QFl%vx?Ju;7m4vo0w{a${tdV`E&C>oSb7ncAS*odUmJ*sw zC9#AUZ}V(NOQk|p4JbSDL?NN3x2L|Ge?RSiEtiT@J40;|QQ-7ge-%MFvD%)fu`2Z& zZC_Ln+9@iYT0*r@O^i2HH6`QxQ&OW&3vguTI@#2cv3X30m_y7bs@N#bnk-F-O ktXfiD7Ax}oiHmGVe-KN_C~-%^*$-kjbJF8tMY-*+|Hdes1poj5 diff --git a/apps/funding/locale/pl/LC_MESSAGES/django.po b/apps/funding/locale/pl/LC_MESSAGES/django.po index a8421b172..0543b8ac8 100644 --- a/apps/funding/locale/pl/LC_MESSAGES/django.po +++ b/apps/funding/locale/pl/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-06-21 16:32+0200\n" +"POT-Creation-Date: 2013-06-25 11:55+0200\n" "PO-Revision-Date: 2013-04-25 13:03+0100\n" "Last-Translator: Radek Czajka \n" "Language-Team: LANGUAGE \n" @@ -42,122 +42,159 @@ msgstr "" "Użyjemy go do kontaktu w sprawie prezentów i informacji o zmianach statusu " "zbiórki i kolejnych akcjach.
Nie będzie publikowany." -#: models.py:16 +#: models.py:19 msgid "author" msgstr "autor" -#: models.py:17 +#: models.py:20 msgid "title" msgstr "tytuł" -#: models.py:18 +#: models.py:21 msgid "slug" msgstr "slug" -#: models.py:19 models.py:114 +#: models.py:22 models.py:117 msgid "description" msgstr "opis" -#: models.py:20 +#: models.py:23 msgid "target" msgstr "kwota docelowa" -#: models.py:21 +#: models.py:24 msgid "start" msgstr "początek" -#: models.py:22 +#: models.py:25 msgid "end" msgstr "koniec" -#: models.py:23 +#: models.py:26 msgid "due" msgstr "data publikacji" -#: models.py:24 +#: models.py:27 msgid "When will it be published if the money is raised." msgstr "Kiedy książka zostanie opublikowana, jeśli uda się zebrać pieniądze." -#: models.py:25 +#: models.py:28 msgid "redakcja URL" msgstr "URL na Redakcji" -#: models.py:27 +#: models.py:30 msgid "Published book." msgstr "Opublikowana książka." -#: models.py:28 +#: models.py:31 msgid "Cover" msgstr "Okładka" -#: models.py:29 +#: models.py:32 msgid "Poll" msgstr "Ankieta" -#: models.py:33 +#: models.py:36 msgid "Cover preview" msgstr "Podgląd okładki" -#: models.py:37 models.py:111 models.py:132 +#: models.py:40 models.py:114 models.py:135 msgid "offer" msgstr "zbiórka" -#: models.py:38 +#: models.py:41 msgid "offers" msgstr "zbiórki" -#: models.py:112 +#: models.py:115 msgid "price" msgstr "cena" -#: models.py:113 models.py:133 +#: models.py:116 models.py:136 msgid "name" msgstr "nazwa" -#: models.py:115 +#: models.py:118 msgid "end date" msgstr "data końcowa" -#: models.py:118 +#: models.py:121 msgid "perk" msgstr "prezent" -#: models.py:119 models.py:137 +#: models.py:122 models.py:140 msgid "perks" msgstr "prezenty" -#: models.py:134 +#: models.py:137 msgid "email" msgstr "e-mail" -#: models.py:135 models.py:164 +#: models.py:138 models.py:167 msgid "amount" msgstr "kwota" -#: models.py:136 +#: models.py:139 msgid "payed at" msgstr "data wpłaty" -#: models.py:147 +#: models.py:150 msgid "funding" msgstr "wpłata" -#: models.py:148 +#: models.py:151 msgid "fundings" msgstr "wpłaty" -#: models.py:165 +#: models.py:168 msgid "when" msgstr "kiedy" -#: models.py:168 +#: models.py:171 msgid "money spent on a book" msgstr "pieniądze wydane na książkę" -#: models.py:169 +#: models.py:172 msgid "money spent on books" msgstr "pieniądze wydane na książki" +#: models.py:202 templates/funding/thanks.html:6 +#: templates/funding/thanks.html.py:13 +msgid "Thank you for your support!" +msgstr "Dziękujemy za Twoje wsparcie!" + +#: templates/funding/email.txt:3 +msgid "Hi" +msgstr "Cześć" + +#: templates/funding/email.txt:5 +msgid "" +"Thank you for your support - thanks to you we will set another book free." +msgstr "Dziękujemy za wsparcie - dzięki Tobie uwolnimy kolejną książkę." + +#: templates/funding/email.txt:7 +msgid "The book will be supplemented with your name as a donor." +msgstr "" +"Twoje imię i nazwisko lub pseudonim zostaną dodane do listy darczyńców przy " +"opublikowanej książce." + +#: templates/funding/email.txt:9 +msgid "" +"We will contact you to keep you informed about your perks,\n" +"status changes to this fundraiser and the incoming ones that we plan to " +"launch." +msgstr "" +"Skontaktujemy się Tobą w sprawie prezentów i informacji o zmianach statusu " +"zbiórki oraz kolejnych akcjach." + +#: templates/funding/email.txt:12 +msgid "" +"Cheers,\n" +"Wolne Lektury team" +msgstr "" +"Pozdrawiamy,\n" +"zespół Wolnych Lektur" + #: templates/funding/no_thanks.html:5 templates/funding/no_thanks.html.py:9 msgid "Payment failed" msgstr "Płatność nie doszła do skutku" @@ -226,10 +263,6 @@ msgstr "Aktualna zbiórka:" msgid "Previous fundraisers:" msgstr "Poprzednie zbiórki:" -#: templates/funding/thanks.html:6 templates/funding/thanks.html.py:13 -msgid "Thank you for your support!" -msgstr "Dziękujemy za Twoje wsparcie!" - #: templates/funding/thanks.html:10 msgid "Thank you!" msgstr "Dziękujemy!" diff --git a/apps/funding/models.py b/apps/funding/models.py index 162d33739..0e05e1dcd 100644 --- a/apps/funding/models.py +++ b/apps/funding/models.py @@ -4,6 +4,9 @@ # from datetime import date, datetime from django.core.urlresolvers import reverse +from django.core.mail import send_mail +from django.conf import settings +from django.template.loader import render_to_string from django.db import models from django.utils.translation import ugettext_lazy as _, ugettext as __ import getpaid @@ -190,4 +193,15 @@ def payment_status_changed_listener(sender, instance, old_status, new_status, ** if old_status != 'paid' and new_status == 'paid': instance.order.payed_at = datetime.now() instance.order.save() + if instance.order.email: + send_thank_you_email(instance.order.name, instance.order.email) getpaid.signals.payment_status_changed.connect(payment_status_changed_listener) + +def send_thank_you_email(name, address): + send_mail(_('Thank you for your support!'), + render_to_string('funding/email.txt', dict(name = name)), + getattr(settings, 'CONTACT_EMAIL', 'wolnelektury@nowoczesnapolska.org.pl'), + [address], + fail_silently=False + ) + diff --git a/apps/funding/templates/funding/email.txt b/apps/funding/templates/funding/email.txt new file mode 100644 index 000000000..e5487671d --- /dev/null +++ b/apps/funding/templates/funding/email.txt @@ -0,0 +1,13 @@ +{% load i18n %} + +{% trans 'Hi' %}{% if name %} {{name}}{% endif %}, + +{% trans 'Thank you for your support - thanks to you we will set another book free.' %}{% if name %} + +{% trans 'The book will be supplemented with your name as a donor.' %}{% endif %} + +{% blocktrans %}We will contact you to keep you informed about your perks, +status changes to this fundraiser and the incoming ones that we plan to launch.{% endblocktrans %} + +{% blocktrans %}Cheers, +Wolne Lektury team{% endblocktrans %} -- 2.20.1