From 1c43c3b9f47e5814a99d3067c1c3f01df14da118 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Koci=C3=A1n?= Date: Fri, 28 Oct 2016 12:19:42 +0200 Subject: [PATCH 1/3] =?UTF-8?q?Korektury:=20oprava=20p=C5=99ekryv=C5=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- korektury/templates/korektury/opraf.html | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/korektury/templates/korektury/opraf.html b/korektury/templates/korektury/opraf.html index 04cfc2de..6a92f28c 100644 --- a/korektury/templates/korektury/opraf.html +++ b/korektury/templates/korektury/opraf.html @@ -7,7 +7,7 @@ Korektury {{pdf.nazev}} - +

Korektury {{pdf.nazev}}

{% if pdf.status = 'zanaseni' %}

Probíhá zanášení korektur, zvažte, zda chcete přidávat nové

{% endif %} {% if pdf.status = 'zastarale' %}

Toto PDF je již zastaralé, nepřidávejte nové korektury

{% endif %} @@ -192,9 +192,11 @@ ["img-{{s.strana}}", [{% for o in s.op_id %}["op{{o.id}}",{{o.x}},{{o.y}}],{% endfor %}[]]], {% endfor %} []] - for (var i=0;i Date: Sun, 6 Nov 2016 16:39:45 +0100 Subject: [PATCH 2/3] =?UTF-8?q?Korektury:=20po=C5=A1li=20mail=20i=20autoro?= =?UTF-8?q?vi=20okom.=20korektury?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- korektury/views.py | 19 +++++++++++++++---- mamweb/settings_common.py | 10 +++++++--- mamweb/settings_prod.py | 2 ++ mamweb/settings_test.py | 5 +---- 4 files changed, 25 insertions(+), 11 deletions(-) diff --git a/korektury/views.py b/korektury/views.py index 5eb42bd1..70cfaf6e 100644 --- a/korektury/views.py +++ b/korektury/views.py @@ -135,21 +135,32 @@ class KorekturyView(generic.TemplateView): # Prijemci e-mailu emails = set() + # e-mail autora korektury email = oprava.autor.user.email - # nalezeni e-mailu na organizatory komentaru + if email: + emails.add(email) + + # nalezeni e-mailu na autory komentaru for komentar in oprava.komentar_set.all(): - email = komentar.autor.user.email - if email: - emails.add(email) + email_komentujiciho = komentar.autor.user.email + if email_komentujiciho: + emails.add(email_komentujiciho) + # zodpovedny org if oprava.pdf.org: email_zobpovedny = oprava.pdf.org.user.email if email_zobpovedny: emails.add(email_zobpovedny) + # odstran e-mail autora opravy + email = autor.user.email if email: emails.discard(email) + if not settings.SEND_EMAIL_NOTIFICATIONS: + print "Poslal bych upozornění na tyto adresy: ", " ".join(emails) + return + send_mail(subject, text, from_email, list(emails)) def get_context_data(self, **kwargs): diff --git a/mamweb/settings_common.py b/mamweb/settings_common.py index a1025b07..ad2b7fd7 100644 --- a/mamweb/settings_common.py +++ b/mamweb/settings_common.py @@ -242,6 +242,10 @@ LOGGING = { SEMINAR_RESENI_DIR = os.path.join('reseni') SEMINAR_KONFERY_DIR = os.path.join('konfery') -KOREKTURY_PDF_DIR = os.path.join('korektury','pdf') -KOREKTURY_IMG_DIR = os.path.join('korektury','img') -CISLO_IMG_DIR = os.path.join('cislo','img') +KOREKTURY_PDF_DIR = os.path.join('korektury', 'pdf') +KOREKTURY_IMG_DIR = os.path.join('korektury', 'img') +CISLO_IMG_DIR = os.path.join('cislo', 'img') + + +# E-MAIL NOTIFICATIONS +SEND_EMAIL_NOTIFICATIONS = False diff --git a/mamweb/settings_prod.py b/mamweb/settings_prod.py index b56a9380..8b75ce74 100644 --- a/mamweb/settings_prod.py +++ b/mamweb/settings_prod.py @@ -67,3 +67,5 @@ LOGGING['loggers']['']['handlers'] = ['console', 'mail_admins'] LOGGING['loggers']['django']['handlers'] = ['console', 'mail_admins'] +# E-MAIL NOTIFICATIONS +SEND_EMAIL_NOTIFICATIONS = True diff --git a/mamweb/settings_test.py b/mamweb/settings_test.py index 3d1b0010..6ffd42b8 100644 --- a/mamweb/settings_test.py +++ b/mamweb/settings_test.py @@ -10,7 +10,7 @@ import os.path # # Import common settings -from .settings_common import * +from .settings_common import LOGGING # Quick-start development settings - unsuitable for production @@ -63,6 +63,3 @@ CSRF_COOKIE_SECURE = True LOGGING['loggers']['']['handlers'] = ['console', 'mail_admins'] LOGGING['loggers']['django']['handlers'] = ['console', 'mail_admins'] - - - From d34f75e455b09c1fe00bde7aea2251fd5181e28c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Koci=C3=A1n?= Date: Sun, 6 Nov 2016 16:39:45 +0100 Subject: [PATCH 3/3] =?UTF-8?q?Korektury:=20po=C5=A1li=20mail=20i=20autoro?= =?UTF-8?q?vi=20okom.=20korektury?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- korektury/views.py | 19 +++++++++++++++---- mamweb/settings_common.py | 10 +++++++--- mamweb/settings_prod.py | 2 ++ mamweb/settings_test.py | 5 +---- 4 files changed, 25 insertions(+), 11 deletions(-) diff --git a/korektury/views.py b/korektury/views.py index 5eb42bd1..70cfaf6e 100644 --- a/korektury/views.py +++ b/korektury/views.py @@ -135,21 +135,32 @@ class KorekturyView(generic.TemplateView): # Prijemci e-mailu emails = set() + # e-mail autora korektury email = oprava.autor.user.email - # nalezeni e-mailu na organizatory komentaru + if email: + emails.add(email) + + # nalezeni e-mailu na autory komentaru for komentar in oprava.komentar_set.all(): - email = komentar.autor.user.email - if email: - emails.add(email) + email_komentujiciho = komentar.autor.user.email + if email_komentujiciho: + emails.add(email_komentujiciho) + # zodpovedny org if oprava.pdf.org: email_zobpovedny = oprava.pdf.org.user.email if email_zobpovedny: emails.add(email_zobpovedny) + # odstran e-mail autora opravy + email = autor.user.email if email: emails.discard(email) + if not settings.SEND_EMAIL_NOTIFICATIONS: + print "Poslal bych upozornění na tyto adresy: ", " ".join(emails) + return + send_mail(subject, text, from_email, list(emails)) def get_context_data(self, **kwargs): diff --git a/mamweb/settings_common.py b/mamweb/settings_common.py index a1025b07..ad2b7fd7 100644 --- a/mamweb/settings_common.py +++ b/mamweb/settings_common.py @@ -242,6 +242,10 @@ LOGGING = { SEMINAR_RESENI_DIR = os.path.join('reseni') SEMINAR_KONFERY_DIR = os.path.join('konfery') -KOREKTURY_PDF_DIR = os.path.join('korektury','pdf') -KOREKTURY_IMG_DIR = os.path.join('korektury','img') -CISLO_IMG_DIR = os.path.join('cislo','img') +KOREKTURY_PDF_DIR = os.path.join('korektury', 'pdf') +KOREKTURY_IMG_DIR = os.path.join('korektury', 'img') +CISLO_IMG_DIR = os.path.join('cislo', 'img') + + +# E-MAIL NOTIFICATIONS +SEND_EMAIL_NOTIFICATIONS = False diff --git a/mamweb/settings_prod.py b/mamweb/settings_prod.py index b56a9380..8b75ce74 100644 --- a/mamweb/settings_prod.py +++ b/mamweb/settings_prod.py @@ -67,3 +67,5 @@ LOGGING['loggers']['']['handlers'] = ['console', 'mail_admins'] LOGGING['loggers']['django']['handlers'] = ['console', 'mail_admins'] +# E-MAIL NOTIFICATIONS +SEND_EMAIL_NOTIFICATIONS = True diff --git a/mamweb/settings_test.py b/mamweb/settings_test.py index 3d1b0010..7ca1c627 100644 --- a/mamweb/settings_test.py +++ b/mamweb/settings_test.py @@ -10,7 +10,7 @@ import os.path # # Import common settings -from .settings_common import * +from .settings_common import * # zatim nutne, casem snad vyresime # noqa # Quick-start development settings - unsuitable for production @@ -63,6 +63,3 @@ CSRF_COOKIE_SECURE = True LOGGING['loggers']['']['handlers'] = ['console', 'mail_admins'] LOGGING['loggers']['django']['handlers'] = ['console', 'mail_admins'] - - -