def is_match_of(self, team_name): """ :param team_name: the name of the football team :return: True if the highlight is for a match with this team """ team_name = mapping_football_team.get_exact_name(team_name.lower()) return self.team1.name.startswith(team_name) or self.team2.name.startswith(team_name)
def __init__(self, link, match_name, img_link, view_count, category, time_since_added): self.link = self.form_link(link) self.img_link = img_link self.view_count = view_count self.category = mapping_football_competition.get_exact_name( category.lower()) self.time_since_added = time_since_added # Match information team1, score1, team2, score2 = self.get_match_info(match_name) # Run mapping for football team names as team can be named differently self.team1 = mapping_football_team.get_exact_name(team1.lower()) self.team2 = mapping_football_team.get_exact_name(team2.lower()) self.score1 = score1 self.score2 = score2 # Source of the highlight (website) self.source = self.get_source()
def handle(self, *args, **options): all_teams = football_team_manager.get_all_football_team_names() for team_name in all_teams: exact_team_name = mapping_football_team.get_exact_name(team_name) if not team_name == exact_team_name: # add team name football_team_manager.add_football_team(exact_team_name) # delete old team name football_team_manager.delete_football_team(team_name)
def has_football_team(name): name = mapping_football_team.get_exact_name(name) return [team for team in FootballTeam.objects.filter(name=name)]