@register.filter
def follows(from_user, to_user):
 try:
  relationship = Relationship.objects.get_relationship(from_user, to_user)
  if (relationship and (not relationship.is_blocked)):
   return True
  else:
   return False
 except AttributeError:
  return False

@ register . filter def follows ( from_user , to_user ) : try : relationship = Relationship . objects . get_relationship ( from_user , to_user ) if ( relationship and ( not relationship . is_blocked ) ) : return True else : return False except AttributeError : return False
returns true if the first user follows the second .