@register.filter
def check_in_set(value, arg):
    
    if arg.filter(pk=value.pk).count():
        return "checked"
    else:
        return ""
returns "checked" if the value is in QuerySet arg else ""
dataset/ETHPy150Open fp7-ofelia/ocf/optin_manager/src/python/openflow/common/utils/templatetags/ch_extras.py/check_in_set