from wtem.management.commands import send_mail
from django.utils import translation
from django.template.loader import render_to_string
from wtem.management.commands import send_mail
from django.utils import translation
from django.template.loader import render_to_string
def handle_to_students(self, *args, **options):
self.stdout.write('>>> Sending results to students')
def handle_to_students(self, *args, **options):
self.stdout.write('>>> Sending results to students')
final_result = submission.final_result
if final_result < minimum:
template = 'results_student_failed.txt'
else:
template = 'results_student_passed.txt'
final_result = submission.final_result
if final_result < minimum:
template = 'results_student_failed.txt'
else:
template = 'results_student_passed.txt'
submissions_by_contact.setdefault(submission.contact.id, []).append(submission)
for contact_id, submissions in submissions_by_contact.items():
contact = Contact.objects.get(id=contact_id)
submissions_by_contact.setdefault(submission.contact.id, []).append(submission)
for contact_id, submissions in submissions_by_contact.items():
contact = Contact.objects.get(id=contact_id)
def send_message(self, message, subject, email):
self.stdout.write('>>> sending results to %s' % email)
try:
def send_message(self, message, subject, email):
self.stdout.write('>>> sending results to %s' % email)
try:
self.failed += 1
self.stdout.write('failed sending to: ' + email + ': ' + str(e))
else:
self.sent += 1
self.stdout.write('message sent to: ' + email)
self.failed += 1
self.stdout.write('failed sending to: ' + email + ': ' + str(e))
else:
self.sent += 1
self.stdout.write('message sent to: ' + email)