]> git.parisson.com Git - teleforma.git/commitdiff
update conference publish notification
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Sun, 26 Jun 2022 22:46:27 +0000 (00:46 +0200)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Sun, 26 Jun 2022 22:46:27 +0000 (00:46 +0200)
teleforma/management/commands/teleforma-publish-notify-conferences.py

index 86103ff792c1a74cd66c9018592244609f015f60..476c2f2402ef6e245e320887efe0960ef206b53a 100644 (file)
@@ -1,14 +1,18 @@
 # -*- coding: utf-8 -*-
 
 from optparse import make_option
+import logging
+import os
+from copy import deepcopy
+
 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 teleforma.models import *
-import logging
-import os
-from copy import deepcopy
+from teleforma.models.notification import notify
+
 
 class Logger:
     """A logging object"""
@@ -27,6 +31,8 @@ class Command(BaseCommand):
             conference.date_publish is equal or greater \
             than current date """
 
+    message = "Nouvelle confĂ©rence"
+
     def handle(self, *args, **options):
         conferences = Conference.objects.filter(notified=False,
                         date_publish__lte=datetime.datetime.now())
@@ -41,7 +47,9 @@ class Command(BaseCommand):
                 for course in courses:
                     if conference.course == course['course'] and \
                         conference.course_type in course['types']:
-                        notify(student.user, conference)
+                        media = conference.media.filter(mime_type__in='video')[0]
+                        url = reverse('teleforma-media-detail', args=[conference.period.id, media.id])
+                        notify(student.user, self.message, url)
 
             conference.notified = True
             conference.save()
\ No newline at end of file