from django import template
from django.utils.translation import ugettext_lazy as _
from django.db.models import Count

register = template.Library()

@register.filter
def genre(value):
    genred = dict([
        (0, _("Albatross")),
        (1, _("20th-Door")),
        (2, _("Little Albat")),
        (3, _("Others & Formal"))])
    return genred[value]

@register.filter
def normalize_star(value):
    return '%.1f' % ((value+5)*10)

@register.filter
def get_unanswered(value):
    try:
        return value.filter(kaitou="").aggregate(Count('id'))['id__count']
    except:
        return 0

@@ -111,16 +111,19 @@
 rt Count
+, Q
 %0A%0Aregist
@@ -515,16 +515,18 @@
 .filter(
+Q(
 kaitou=%22
@@ -527,16 +527,42 @@
 itou=%22%22)
+ %7C Q(kaitou__isnull=True))
 .aggrega

Fix excluded null values