]> git.parisson.com Git - teleforma.git/commitdiff
add script fix message
authorGuillaume Pellerin <yomguy@parisson.com>
Tue, 22 Jul 2014 23:13:13 +0000 (01:13 +0200)
committerGuillaume Pellerin <yomguy@parisson.com>
Tue, 22 Jul 2014 23:13:13 +0000 (01:13 +0200)
teleforma/exam/templates/exam/messages/script_fix.txt [new file with mode: 0644]
teleforma/management/commands/teleforma-exam-message-bug.py [new file with mode: 0644]

diff --git a/teleforma/exam/templates/exam/messages/script_fix.txt b/teleforma/exam/templates/exam/messages/script_fix.txt
new file mode 100644 (file)
index 0000000..6c33ef6
--- /dev/null
@@ -0,0 +1,14 @@
+{% load i18n %}{% load telemeta_utils %}{% load teleforma_tags %}{% autoescape off %}Bonjour,
+
+Votre copie soumise le {{ script.date_created }} en {{ script.course }} pour la séance {{ script.session }} a été rejetée par erreur.
+
+Merci de re-soumettre votre copie dès que possible. L'ancienne sera effacée.
+
+Veuillez accepter toutes nos excuses pour ce problème technique.
+
+{% trans "Best regards" %},
+{% trans "The site administrator" %} {% trans "of the" %} {% organization %}
+
+
+{% blocktrans %}Note: This message is issued by an automated system.
+Do not reply, this would not be taken into account.{% endblocktrans %}{% endautoescape %}
diff --git a/teleforma/management/commands/teleforma-exam-message-bug.py b/teleforma/management/commands/teleforma-exam-message-bug.py
new file mode 100644 (file)
index 0000000..081aeff
--- /dev/null
@@ -0,0 +1,33 @@
+
+from optparse import make_option
+from django.conf import settings
+from django.core.management.base import BaseCommand, CommandError
+from django.contrib.auth.models import User
+from django.template.defaultfilters import slugify
+from telemeta.models import *
+from telemeta.util.unaccent import unaccent
+from teleforma.exam.models import *
+import logging
+import codecs
+import time, os
+
+
+class Command(BaseCommand):
+    help = "Send a message"
+
+    def handle(self, *args, **options):
+        sender = User.objects.get(id=0)
+        site = Site.objects.all()[0]
+        subject = 'Erreur dans la transmission de votre copie'
+        scripts = Script.objects.filter(file='scripts/2014/07/22/home')
+        print scripts.count()
+
+        for script in scripts:
+            context = {'script': self, 'site': site}
+            text = render_to_string('exam/messages/script_fix.txt', context)
+            print text
+            mess = Message(sender=sender, recipient=script.author, subject=subject[:119], body=text)
+            mess.moderation_status = 'a'
+            #mess.save()
+            #notify_user(mess, 'acceptance', site)
+