send-to-mycourse: correctly handle the sent field of the BlackBoardPush model

This commit is contained in:
Benjamin Dauvergne 2012-12-05 16:10:58 +01:00
parent 0958572d38
commit 27fb912080
1 changed files with 2 additions and 2 deletions

View File

@ -26,7 +26,7 @@ class Command(BaseCommand):
@transaction.commit_on_success
def handle(self, *args, **options):
logger = logging.getLogger()
bb_pushs = models.BlackBoardPush.objects.filter(request__history__new_status__start=True)
bb_pushs = models.BlackBoardPush.objects.filter(request__history__new_status__start=True, sent=False)
if options['list']:
for push in bb_pushs:
print ' - document', os.path.basename(push.request.uploadfile.name), 'de', push.request.user.display_name(), 'dans le cours', push.course_name,
@ -43,7 +43,7 @@ class Command(BaseCommand):
logger.info('visible to students')
ok, result = conn.send_file(push.request.uploadfile, [push.course_name], push.visible_to_students)
if ok:
push.send = True
push.sent = True
push.save()
logger.info('sending succeeded')
else: