From 49e56d97e5a126f66d1d52b5de45befe603893b2 Mon Sep 17 00:00:00 2001
From: Alban Gruin
Date: Thu, 7 Sep 2017 23:31:54 +0200
Subject: Remplacement de la licence GPL 2 par la licence AGPL 3
---
management/commands/sendmails.py | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
(limited to 'management/commands/sendmails.py')
diff --git a/management/commands/sendmails.py b/management/commands/sendmails.py
index c7725b7..e81980b 100644
--- a/management/commands/sendmails.py
+++ b/management/commands/sendmails.py
@@ -1,18 +1,17 @@
# Copyright (C) 2017 Alban Gruin
#
-# celcatsanitizer is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
+# celcatsanitizer is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published
+# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# celcatsanitizer is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
+# GNU Affero General Public License for more details.
#
-# You should have received a copy of the GNU General Public License along
-# with celcatsanitizer; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+# You should have received a copy of the GNU Affero General Public License
+# along with celcatsanitizer. If not, see .
from django.core.management.base import BaseCommand
from django.core.mail import send_mass_mail
--
cgit v1.2.1
From 7eee2b573efd3eefb89545f6d6682216801c9126 Mon Sep 17 00:00:00 2001
From: Alban Gruin
Date: Fri, 8 Sep 2017 12:07:41 +0200
Subject: Suppression des .name dans sendmails
---
management/commands/sendmails.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'management/commands/sendmails.py')
diff --git a/management/commands/sendmails.py b/management/commands/sendmails.py
index e81980b..3c0fab0 100644
--- a/management/commands/sendmails.py
+++ b/management/commands/sendmails.py
@@ -58,7 +58,7 @@ class Command(BaseCommand):
if not options["test"]:
context = Context({"admins": settings.ADMINS, "token": subscription.token, "domain": settings.DEFAULT_DOMAIN})
mail_content = content[subscription.group.id] + footer.render(context)
- mails.append(("{0} - {1} - Semaine {2}".format(subscription.group.timetable.name, subscription.group.name, week), mail_content, settings.DEFAULT_FROM_EMAIL, [subscription.email],))
+ mails.append(("{0} - {1} - Semaine {2}".format(subscription.group.timetable, subscription.group, week), mail_content, settings.DEFAULT_FROM_EMAIL, [subscription.email],))
if not options["test"]:
print("Sending mails...")
--
cgit v1.2.1
From c7fce37ad4c8dee76f5d58eafefd0c73a03ea00c Mon Sep 17 00:00:00 2001
From: Alban Gruin
Date: Sat, 9 Sep 2017 14:56:17 +0200
Subject: Suppression de l’envoi des mails
---
management/commands/sendmails.py | 67 ----------------------------------------
1 file changed, 67 deletions(-)
delete mode 100644 management/commands/sendmails.py
(limited to 'management/commands/sendmails.py')
diff --git a/management/commands/sendmails.py b/management/commands/sendmails.py
deleted file mode 100644
index 3c0fab0..0000000
--- a/management/commands/sendmails.py
+++ /dev/null
@@ -1,67 +0,0 @@
-# Copyright (C) 2017 Alban Gruin
-#
-# celcatsanitizer is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published
-# by the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# celcatsanitizer is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with celcatsanitizer. If not, see .
-
-from django.core.management.base import BaseCommand
-from django.core.mail import send_mass_mail
-from django.utils import translation
-from django.template import Context, loader
-from django.conf import settings
-
-from edt.models import Course, Subscription
-from edt.utils import get_current_or_next_week, get_week, group_courses
-
-
-class Command(BaseCommand):
- help = "Sends emails to subscribed users"
-
- def add_arguments(self, parser):
- parser.add_argument("--test", help="Print the content of mails instead of sending them", action="store_true")
-
- def handle(self, *args, **options):
- translation.activate(settings.LANGUAGE_CODE)
-
- year, week = get_current_or_next_week()
- start, end = get_week(year, week)
-
- subscriptions = Subscription.objects.filter(active=True)
- content = {}
- mails = []
-
- footer = loader.get_template("mail/mail_footer.txt")
- timetable = loader.get_template("mail/mail_timetable.txt")
-
- print("Generating messages...")
- for subscription in subscriptions:
- if subscription.group.id not in content:
- courses = Course.objects.get_courses_for_group(subscription.group, begin__gte=start, begin__lt=end)
-
- grouped_courses = group_courses(courses)
- context = Context({"courses": grouped_courses, "group": subscription.group, "week": week})
- content[subscription.group.id] = timetable.render(context)
-
- if options["test"]:
- print(subscription.group)
- print(content[subscription.group.id])
-
- if not options["test"]:
- context = Context({"admins": settings.ADMINS, "token": subscription.token, "domain": settings.DEFAULT_DOMAIN})
- mail_content = content[subscription.group.id] + footer.render(context)
- mails.append(("{0} - {1} - Semaine {2}".format(subscription.group.timetable, subscription.group, week), mail_content, settings.DEFAULT_FROM_EMAIL, [subscription.email],))
-
- if not options["test"]:
- print("Sending mails...")
- send_mass_mail(mails)
-
- self.stdout.write(self.style.SUCCESS("Done."))
--
cgit v1.2.1