from django.db import models from django.utils.safestring import mark_safe from django.utils.translation import ugettext_lazy as _ import re class VideoContent(models.Model): video = models.URLField(_('video link'),help_text=_('This should be a link to a youtube video, i.e.: http://www.youtube.com/watch?v=zmj1rpzDRZ0')) class Meta: abstract = True verbose_name = _('video') verbose_name_plural = _('videos') def render(self, **kwargs): vid = re.search('(?<==)\w+',self.video) ret = """