]> git.parisson.com Git - teleforma.git/commitdiff
use post_save
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Mon, 23 Jan 2023 09:53:18 +0000 (10:53 +0100)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Mon, 23 Jan 2023 09:53:18 +0000 (10:53 +0100)
teleforma/models/core.py

index 249b82d5a19a3b161f417bfa06d757716fb20a9c..8d4c249987626a6b3ff7069913d076b8dc3cce11 100755 (executable)
@@ -485,9 +485,6 @@ class Conference(models.Model):
         if not self.public_id:
             self.public_id = get_random_hash()
         self.course.save()
-        self.notify_sync()
-        if not self.notified_live:
-            self.notified_live = True
         super(Conference, self).save(*args, **kwargs)
 
     def to_dict(self):
@@ -629,6 +626,16 @@ class Conference(models.Model):
             models.Index(fields=['course', 'course_type', 'period', 'streaming', '-date_begin' ]),
          ]
 
+
+def notif_conference(sender, instance, *args, **kwargs):
+    if not instance.notified_live:
+        instance.notify_sync()
+        instance.notified_live = True
+        instance.save()
+
+post_save.connect(notif_conference, sender=Conference)
+
+
 class StreamingServer(models.Model):
 
     element_type = 'streamingserver'