@register.filter
def has_permissions(user, component):
 return user.has_perms(getattr(component, 'permissions', set()))

@ register . filter def has_permissions ( user , component ) : return user . has_perms ( getattr ( component , 'permissions' , set ( ) ) )
checks if the given user meets the permissions requirements for the component .