mirror of
https://gitlab.com/animath/si/plateforme-corres2math.git
synced 2025-07-05 07:14:08 +02:00
Render solution video in a modal
This commit is contained in:
@ -1,5 +1,7 @@
|
||||
import re
|
||||
|
||||
from django.template.loader import render_to_string
|
||||
|
||||
from corres2math.lists import get_sympa_client
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
from django.core.validators import RegexValidator
|
||||
@ -162,6 +164,11 @@ class Video(models.Model):
|
||||
return re.compile("(https?://|)(www\\.|)(youtube\\.com/watch\\?v=|youtu\\.be/)([a-zA-Z0-9-_]*)?.*?")\
|
||||
.match("https://www.youtube.com/watch?v=73nsrixx7eI").group(4)
|
||||
|
||||
def as_iframe(self):
|
||||
if self.platform == "youtube":
|
||||
return render_to_string("participation/youtube_iframe.html", context=dict(youtube_code=self.youtube_code))
|
||||
return None
|
||||
|
||||
def __str__(self):
|
||||
return _("Video of team {name} ({trigram})")\
|
||||
.format(name=self.participation.team.name, trigram=self.participation.team.trigram)
|
||||
|
Reference in New Issue
Block a user