Skip to main content

Django template tags for YouTube and Vimeo

Project description

Django app for easy embeding YouTube and Vimeo videos.

Installation

pip install django-embed-video

Add embed_video to INSTALLED_APPS in your Django settings.

Examples

Template examples

First you have to load the embed_video_tags template tags in your template:

{% load embed_video_tags %}

Simple embeding of video:

{% video item.video as video %}
    {{ video|embed:'small' }}
{% endvideo %}

Default sizes are tiny (420x315), small (480x360), medium (640x480), large (960x720) and huge (1280x960). You can set your own size:

{{ video|embed:'800x600' }}

Usage of variables:

{% video item.video as video %}
    URL: {{ video.url }}
    Thumbnail: {{ video.thumbnail }}
{% endvideo %}

Model examples

Using the EmbedVideoField you provide validation of correct URL.

from django.db import models
from embed_video.fields import EmbedVideoField

class Item(models.Model):
    video = EmbedVideoField()  # same like models.URLField()

TODO

  • provide AdminEmbedVideoMixin

  • Vimeo thumbnail

Changes

0.1

  • Initial release

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-embed-video-0.1.0.tar.gz (5.3 kB view details)

Uploaded Source

File details

Details for the file django-embed-video-0.1.0.tar.gz.

File metadata

File hashes

Hashes for django-embed-video-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2470217fe5c9f868ed816dacf0d00ff9d653bb693282a2476202432a4e3af000
MD5 63134f944af90f7982c5fa4a7f0478b5
BLAKE2b-256 c1b4b010c2952688605b6ad7250e5fd842058697dd6e9298a7e2eed149f386e3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page