from django import template

register = template.Library()

@register.filter(name='governing')
def governing(party, date):
    return party.is_governing(date)


@@ -20,16 +20,54 @@
 template
+%0Afrom ..models import Party, Statement
 %0A%0Aregist
@@ -144,33 +144,477 @@
 ing(
-party, date):%0A    return 
+obj, date=None):%0A    if isinstance(obj, Party):%0A        assert date is not None, %22Date must be supplied when 'govern' is called with a Party object%22%0A        return obj.is_governing(date)%0A    elif isinstance(obj, Statement):%0A        if obj.member is None:%0A            if 'ministeri' in obj.speaker_role:%0A                return True%0A            else:%0A                return False%0A        if date is None:%0A            date = obj.item.plsess.date%0A        return obj.member.
 part
@@ -634,9 +634,8 @@
 g(date)%0A
-%0A

Allow governing templatetag to be called with a Statement object