django-embed-video/README.rst

80 lines
1.9 KiB
ReStructuredText
Raw Normal View History

2013-05-31 11:22:44 +00:00
django-embed-video
==================
2013-06-26 10:54:56 +00:00
Django app for easy embeding YouTube and Vimeo videos and music from SoundCloud.
.. image:: https://travis-ci.org/yetty/django-embed-video.png?branch=master
2013-06-27 08:12:00 +00:00
:target: https://travis-ci.org/yetty/django-embed-video
2013-07-30 21:31:31 +00:00
.. image:: https://coveralls.io/repos/yetty/django-embed-video/badge.png?branch=master
:target: https://coveralls.io/r/yetty/django-embed-video?branch=master
.. image:: https://pypip.in/v/django-embed-video/badge.png
:target: https://crate.io/packages/django-embed-video/
.. image:: https://pypip.in/d/django-embed-video/badge.png
:target: https://crate.io/packages/django-embed-video/
2013-05-31 11:22:44 +00:00
2013-08-22 08:53:31 +00:00
Documentation
*************
2013-06-01 13:01:52 +00:00
2013-08-22 08:55:25 +00:00
Documentation is here: http://django-embed-video.rtfd.org/
2013-06-01 13:38:53 +00:00
2013-06-01 13:21:01 +00:00
2013-08-22 08:53:31 +00:00
Quick start
************
2013-06-01 13:01:52 +00:00
2013-08-22 08:53:31 +00:00
#. Install ``django-embed-video``:
2013-06-01 13:01:52 +00:00
2013-08-22 08:53:31 +00:00
::
2013-06-01 13:01:52 +00:00
2013-08-22 08:53:31 +00:00
pip install django-embed-video
2013-06-01 13:01:52 +00:00
2013-06-01 13:21:01 +00:00
2013-08-22 08:53:31 +00:00
or from sources
2013-06-01 13:01:52 +00:00
2013-08-22 08:53:31 +00:00
::
2013-06-01 13:01:52 +00:00
2013-08-22 08:53:31 +00:00
pip install git+https://github.com/yetty/django-embed-video.git
2013-06-01 13:21:01 +00:00
2013-06-01 13:01:52 +00:00
2013-08-22 08:53:31 +00:00
#. Add ``embed_video`` to ``INSTALLED_APPS`` in your Django settings.
2013-06-01 13:21:01 +00:00
2013-12-23 08:50:32 +00:00
#. If you want to detect HTTP/S in template tags, you have to set ``request``
context processor in ``settings.TEMPLATE_CONTEXT_PROCESSORS``:
2013-06-01 13:01:52 +00:00
2013-12-23 08:50:32 +00:00
::
TEMPLATE_CONTEXT_PROCESSORS = (
...
'django.core.context_processors.request',
)
#. Usage of template tags:
2013-06-01 13:01:52 +00:00
2013-08-22 08:53:31 +00:00
::
2013-06-01 13:01:52 +00:00
2013-08-22 08:53:31 +00:00
{% load embed_video_tags %}
2013-06-01 13:21:01 +00:00
2013-08-22 08:53:31 +00:00
The video tag:
{% video item.video as my_video %}
2013-06-27 08:10:27 +00:00
URL: {{ my_video.url }}
Thumbnail: {{ my_video.thumbnail }}
Backend: {{ my_video.backend }}
2013-12-23 08:50:32 +00:00
2014-01-07 09:05:38 +00:00
{% video my_video "large" %}
2013-08-22 08:53:31 +00:00
{% endvideo %}
2013-06-01 13:01:52 +00:00
2013-08-22 08:53:31 +00:00
Or embed shortcut:
{% video my_video '800x600' %}
2013-06-01 13:01:52 +00:00
2013-12-23 08:50:32 +00:00
#. Usage of model fields
2013-08-22 08:53:31 +00:00
::
2013-08-22 08:53:31 +00:00
from django.db import models
from embed_video.fields import EmbedVideoField
2013-06-01 13:01:52 +00:00
2013-08-22 08:53:31 +00:00
class Item(models.Model):
video = EmbedVideoField() # same like models.URLField()
2013-06-01 13:01:52 +00:00
.. vim: set tw=80: