@register.filter
def get_relationship(from_user, to_user):
 try:
  return Relationship.objects.get_relationship(from_user, to_user)
 except AttributeError:
  return None

@ register . filter def get_relationship ( from_user , to_user ) : try : return Relationship . objects . get_relationship ( from_user , to_user ) except AttributeError : return None
get relationship between two users .