bsavelev / django-youtubefield

Django youtube url field

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

django-youtubefield

Django youtube url field

Installation

pip install git+git://github.com/bsavelev/django-youtubefield.git

Basic usage

Use it like any regular model field:

from youtubeurl_field.modelfields import YoutubeUrlField
class Item(models.Model):
    name = models.CharField(max_length=255)
    video = YoutubeUrlField(blank=True, null=True)

Template usage

Use .embed_url in your templates to insert it in

	{% if item.video %}
	<div class="flex-video widescreen">
		<iframe width="500" height="281" src="{{ item.video.embed_url }}" frameborder="0" allowfullscreen></iframe>
	</div>
	{% else %}

About

Django youtube url field


Languages

Language:Python 100.0%