From e977b7baf9a6e653d6040e9487b7a6cb5fda5fa2 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Wed, 23 Feb 2011 10:53:45 +0100 Subject: [PATCH 1/1] #1223: notifications for suggestions --- apps/suggest/locale/pl/LC_MESSAGES/django.mo | Bin 940 -> 1446 bytes apps/suggest/locale/pl/LC_MESSAGES/django.po | 27 +++++++++++++---- apps/suggest/views.py | 30 ++++++++++++++++++- 3 files changed, 51 insertions(+), 6 deletions(-) diff --git a/apps/suggest/locale/pl/LC_MESSAGES/django.mo b/apps/suggest/locale/pl/LC_MESSAGES/django.mo index f03afa8e76397a87dc61f7a58b4dd7092197247e..40fe313ad98aaa1c935df19ef807f2ad679a7b80 100644 GIT binary patch literal 1446 zcmaKr&yU+g6vqcBztRE{Js|N*?~ZJoEk#wjpf0;h6*b!pyV+d?2Q;x~9mmd$nHghj z2_dZng%he&4pl+?0o;*#Mah4_ffIiLC;kA$cVeg6L&Yf1pLpiI@0&OC{MXADeq{C)wQ-mmTZZ{W9x`5kn5`xh9)k9~y4bKo(!34R8;{r&_x{fFRX@J~>Je}k`q zpFZ8_l%T8eYYNPK_N3895O|v(bdhlqyxwDI`Em zp_-Q1<)-Gjsa z{_Re4BHo^flgRs^h>bT=J?aeiN8Wau&)Y%19&H5Ot`}^08&{|s^xk>*t)LqOaP$tu z7l{*ptl!m*#&5ul^+uXYlewaMbigB#(ss?KDW^@%BZZaH50?`+q$*Wd3nO{1GLv#& z=@Il)4YqFIJaYAH4hA=}#JR0~P{&?>Z+BgM*AF_b+i;8CsLD~4 z6<^x7^Nc6*I)xLijj-<>jXw0Qt^M4daf#lp3>B^{?$NbzVmlu{szyZKky$Q8Q|wN8 zT0zEg3jC}7l@7b*?k}}$KTizfuBoX%WG4wqo~gxy`5h`NvpD0DuiCo`YnceNH- zDb-G+abr6*0@GqDW);=^{1O!VjTog8&L$2TW>?_5F9$_B7#L61VOmeAh92TBq$Z7QwIg7 zYnSRK=;Gw&;^w~)e~a&-89eav, YEAR. -# +# msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-06-02 10:44+0200\n" -"PO-Revision-Date: 2010-06-02 10:45\n" -"Last-Translator: \n" +"POT-Creation-Date: 2011-02-23 10:46+0100\n" +"PO-Revision-Date: 2011-02-23 10:52+0100\n" +"Last-Translator: Radek Czajka \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -48,7 +49,23 @@ msgstr "sugestia" msgid "suggestions" msgstr "sugestie" -#: views.py:31 +#: views.py:49 +msgid "Thank you for your suggestion." +msgstr "Dziękujemy za zgłoszenie." + +#: views.py:51 +msgid "" +"Thank you for your comment on WolneLektury.pl.\n" +"The suggestion has been referred to the project coordinator." +msgstr "" +"Dziękujemy za zgłoszenie uwag do serwisu Wolne Lektury.\n" +"Sugestia została przekazana koordynatorce projektu." + +#: views.py:56 +msgid "Message sent automatically. Please do not reply." +msgstr "Wiadomość wysłana automatycznie. Proszę nie odpowiadać." + +#: views.py:59 msgid "Report was sent successfully." msgstr "Zgłoszenie zostało wysłane." diff --git a/apps/suggest/views.py b/apps/suggest/views.py index ac45cea34..9b3de55d5 100644 --- a/apps/suggest/views.py +++ b/apps/suggest/views.py @@ -2,10 +2,13 @@ # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later. # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. # +from django.core.mail import send_mail, mail_managers +from django.core.urlresolvers import reverse +from django.core.validators import email_re from django.http import HttpResponse, HttpResponseRedirect +from django.utils.translation import ugettext as _ from django.views.decorators import cache from django.views.decorators.http import require_POST -from django.utils.translation import ugettext as _ from suggest import forms from suggest.models import Suggestion @@ -28,6 +31,31 @@ def report(request): suggestion.user = request.user suggestion.save() + mail_managers(u'Nowa sugestia na stronie WolneLektury.pl', u'''\ +Zgłoszono nową sugestię w serwisie WolneLektury.pl. +%(url)s + +Użytkownik: %(user)s +Kontakt: %(contact)s + +%(description)s''' % { + 'url': reverse('admin:suggest_suggestion_change', args=[suggestion.id]), + 'user': str(request.user), + 'contact': contact, + 'description': description, + }, fail_silently=True) + + if email_re.match(contact): + send_mail(u'[WolneLektury] ' + _(u'Thank you for your suggestion.'), + _(u"""\ +Thank you for your comment on WolneLektury.pl. +The suggestion has been referred to the project coordinator.""") + +u""" + +-- +""" + _(u'''Message sent automatically. Please do not reply.'''), + 'no-reply@wolnelektury.pl', [contact], fail_silently=True) + response_data = {'success': True, 'message': _('Report was sent successfully.')} else: response_data = {'success': False, 'errors': suggest_form.errors} -- 2.20.1