bkenny266 / djifts

hockey
4 stars 1 forks source link

Unable to figure out how to add games #1

Open jareds opened 9 years ago

jareds commented 9 years ago

I am unable to figure out how to add games to the database. When running python manage.py shell<build.py I get NameError: name 'add_game' is not defined

In [6]: ------------------------------------------------------------------------

NameError Traceback (most recent call last) /usr/local/lib/python2.7/dist-packages/django/core/management/commands/shell.pyc in () ----> 1 add_game(12020598) NameError: name 'add_game' is not defined

Updating the readme to explain how to add games would be helpful.

bkenny266 commented 9 years ago

Hey, I'm not sure what shell<build.py does. I'm kind of a novice at django and this is my first real programming project in general so you'll have to forgive me. I didn't really actually expect anyone to try to use this.

You can load a game to the db by running manage.py shell, then import datamanger.models and run the load_headers() class method of GameProcessor. This will grab a page of game headers from nhl.com and load it to the database. After that you should be able to load the complete shift data for each of those games using django's admin.

Alternately, you can skip the header stuff and load the games by game number by importing datamanager.utility and running add_game(12020598)