diff --git a/nba_data/management/commands/delete_player_data.py b/nba_data/management/commands/delete_player_data.py new file mode 100644 index 0000000..ece6719 --- /dev/null +++ b/nba_data/management/commands/delete_player_data.py @@ -0,0 +1,12 @@ +from django.core.management.base import BaseCommand +from nba_data.models import PlayerData + +class Command(BaseCommand): + # Provides a description for use with the custom django management command (python manage.py help). + help = 'Delete all player data' + + def handle(self, *args, **options): + # Delete all player data + PlayerData.objects.all().delete() + + self.stdout.write(self.style.SUCCESS('Successfully deleted all players in DB')) \ No newline at end of file diff --git a/nba_data/scraper.py b/nba_data/scraper.py index 2d510b6..de4c42a 100644 --- a/nba_data/scraper.py +++ b/nba_data/scraper.py @@ -32,7 +32,8 @@ for team in teams: if table is None: print(f"Table not found for team {team} and season {season}.") - sys.exit(1) + # sys.exit(1) + continue header_row = table.find("thead").find("tr") rows = table.find("tbody").find_all("tr")