From 5b2e501c52b74ba0e7a6e6c25ae35f2914c8ef8e Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Mon, 27 Jun 2022 00:46:27 +0200 Subject: [PATCH] update conference publish notification --- .../teleforma-publish-notify-conferences.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/teleforma/management/commands/teleforma-publish-notify-conferences.py b/teleforma/management/commands/teleforma-publish-notify-conferences.py index 86103ff7..476c2f24 100644 --- a/teleforma/management/commands/teleforma-publish-notify-conferences.py +++ b/teleforma/management/commands/teleforma-publish-notify-conferences.py @@ -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 -- 2.39.5