Skip to content

kaleidos/django-kvideos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Django Kaleidos Videos

image

image

image

image

Django Kaleidos Videos is a django application for add videos (from services like youtube or vimeo) to any model.

Suported video services

  • Youtube
  • Vimeo

Configuration

Configure the app in your setting INSTALLED_APPS:

INSTALLED_APPS = [
   ...
   kvideos,
   ...
]

Configure, if you want, the default video size in your settings.py:

KVIDEOS_DEFAULT_SIZE = "640x480"

For easy access to the videos, add to your models a generic relation to kvideos.models.Video model, for example:

from kvideos.models import Video
from django.contrib.contenttypes.generic import GenericRelation

class MyModel(models.Model):
    ... # my fields
    videos = GenericRelation(Video)

For integrate it with the admin panel, you can add a new inline to your models admin classes, for example:

from django.contrib.contenttypes.generic import GenericTabularInline
from kvideos.models import Video

class VideoInline(GenericTabularInline):
    model = Video

class MyModelAdmin(admin.ModelAdmin):
    model = models.MyModel
    inlines = [MyOtherInlines, ...,  VideoInline]

Usage

Now you can add videos to any of your models, and can show this on your web page througth the embed_video template tag, for example:

<div>
  {% for video in myobject.videos.all %}
    {% if forloop.first %}
      {{ video.title }}
      {% embed_video video 800x600 %} <!-- Big video first -->
      {{ video.description }}
    {% else %}
      {{ video.title }}
      {% embed_video video %} <!-- Default size videos -->
    {% endif %}
  {% endfor %}
</div>

About

A django app for add to any object videos (youtube/vimeo/...)

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages