view bns_website/videos/views.py @ 62:93e9e7b3d2ae

Put in an import dance for Python 2.5. Apparently cgi.parse_qs was copied to urlparse in Python 2.6. So look for it first in urlparse, and if not found, try cgi.
author Brian Neal <bgneal@gmail.com>
date Sat, 19 Nov 2011 14:47:17 -0600
parents a0d3bc630ebd
children
line wrap: on
line source
"""
Views for the videos application.

"""
import random
from django.shortcuts import render
from videos.models import Playlist


def index(request):
    qs = Playlist.objects.all()
    videos = []
    for playlist in qs:
        videos.extend(playlist.video_list.split(','))

    random.shuffle(videos)

    return render(request, 'videos/index.html', {
        'videos': videos,
        })