def find_users(email):
 return UserProfile.objects.filter((Q(email=email) | Q(history__email=email))).distinct()

def find_users ( email ) : return UserProfile . objects . filter ( ( Q ( email = email ) | Q ( history__email = email ) ) ) . distinct ( )
given an email find all the possible users .