From: Guillaume Pellerin Date: Wed, 25 Jan 2023 10:25:34 +0000 (+0100) Subject: workaround for multiple media of the same type for one conf X-Git-Tag: 2.9.0~87 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=045a4558ed2044dc52431bc0b8c900efb10a27e7;p=teleforma.git workaround for multiple media of the same type for one conf --- diff --git a/teleforma/models/core.py b/teleforma/models/core.py index fdad8526..a40017d4 100755 --- a/teleforma/models/core.py +++ b/teleforma/models/core.py @@ -386,6 +386,7 @@ class ConferencePublication(models.Model): _('status'), choices=STATUS_CHOICES, default=2) notified = models.BooleanField(_('notified'), default=False) + class Conference(models.Model): public_id = models.CharField(_('public_id'), max_length=255, blank=True, unique=True) @@ -596,10 +597,10 @@ class Conference(models.Model): get media video """ try: - return self.media.get(type='mp4') + return self.media.filter(type='mp4')[0] except Media.DoesNotExist: try: - return self.media.get(type='webm') + return self.media.filter(type='webm')[0] except Media.DoesNotExist: pass return None