@register.filter
def friends(user):
 try:
  return Relationship.objects.get_friends_for_user(user)
 except AttributeError:
  return []

@ register . filter def friends ( user ) : try : return Relationship . objects . get_friends_for_user ( user ) except AttributeError : return [ ]
returns people user is following sans people blocking user .