Source

dvd-collection / collection / templatetags / dropdowns.py

Full commit
from django import template
from collection.models import Genre, Movie

register = template.Library()

@register.inclusion_tag('collection/fragments/genre_dropdown.html')
def genre_dropdown(current):
    return {'genre_list':Genre.objects.all(), 'current':current}

@register.inclusion_tag('collection/fragments/format_dropdown.html')
def format_dropdown(current):
    formats = []
    for fmt in Movie.FORMAT_CHOICES:
        formats.append({'name':fmt[1], 'id':fmt[0]})
    return {'format_list':formats, 'current':current}