more youtube fixes
This commit is contained in:
parent
e7192e6bbd
commit
97a9c7951a
1 changed files with 1 additions and 2 deletions
|
@ -21,7 +21,6 @@ class Event(models.Model):
|
|||
media = models.TextField(blank=True, null=True)
|
||||
media_caption = models.TextField(blank=True, null=True, default='')
|
||||
|
||||
|
||||
data = models.JSONField(default=dict, blank=True, editable=False)
|
||||
|
||||
def __str__(self):
|
||||
|
@ -39,7 +38,7 @@ class Event(models.Model):
|
|||
else:
|
||||
url = self.media
|
||||
if 'youtube.com/watch' in url:
|
||||
url = url.replace('/watch', '/embed')
|
||||
url = url.replace('/watch?=v', '/embed/')
|
||||
html += '<iframe src="%s" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>' % url
|
||||
if self.media_caption:
|
||||
html = '<figure>%s<figcaption>%s</figcaption></figure>' % (html, self.media_caption)
|
||||
|
|
Loading…
Reference in a new issue