I have a sports site (MLB) that has games being scraped from ESPN and stored into DB something like
class mlb_games(models.Model):
team_a = models.CharField(max_length=255)
team_h = models.CharField(max_length=255)
time = models.TimeField()
date = models.DateField()
game_id = models.IntegerField(max_length=11)
So basically I would create small little previews for each game. However what happened was teams would play each other on back to back to back days and it would create multiple pages with same content.
So i decided that for each game ever played I would create 1 URL for each game and keep it at that, and update the content to that page after each game is played. However Im having difficulties on the best approach to go about this.
My initial thought was in urls.py capture the 2 teams with regex, and in views serve the content based on filtering for the most recent game, however it then creates the issue of 2 urls being created for each game. /team-a-vs-team-b and /team-b-vs-team-a
Anyways Im just looking for any thoughts or advice on the best way to approach this project. Thanks!
Aucun commentaire:
Enregistrer un commentaire