]> git.parisson.com Git - teleforma.git/commitdiff
add Conference absolute url
authorGuillaume Pellerin <guillaume.pellerin@free.fr>
Mon, 22 Apr 2024 15:15:24 +0000 (17:15 +0200)
committerGuillaume Pellerin <guillaume.pellerin@free.fr>
Mon, 22 Apr 2024 15:15:24 +0000 (17:15 +0200)
teleforma/models/core.py

index e8bb8298d683d953bcc31d79209c8586eb45a0cb..3cf902e52f3f1c1bb12d6f419b05bb80c3842eb1 100644 (file)
@@ -645,6 +645,15 @@ class Conference(models.Model):
             models.Index(fields=['course', 'course_type', 'period', 'streaming', '-date_begin' ]),
          ]
 
+    def get_absolute_url(self):
+        if self.streaming:
+            return reverse_lazy('teleforma-conference-detail',
+                            kwargs={'pk': self.id, 'period_id': self.period.id})
+        else:
+            media = self.media.all()[0]
+            return reverse_lazy('teleforma-media-detail',
+                            kwargs={'pk': media.id, 'period_id': self.period.id})
+
 
 def notif_conference(sender, instance, *args, **kwargs):
     if not instance.notified_live: