Using the following python.py file below as an example, how could a user on a website form select the position from something like a dropdown field or the user could input WR, RB, QB themselves. (position="WR" is currently what is in the code below) and click submit and the code will execute the query into a table?
I am using Wordpress on one server with MySQL. On another server, I am using Python and PostgreSQL. Thank you for any help you can provide.
import nfldb
db = nfldb.connect() q = nfldb.Query(db) q.game(season_year=2015, season_type='Regular')
q.player(position="WR")
q.play(receiving_rec=1)
def inside(field, stat):
cutoff = nfldb.FieldPosition.from_str(field)
return lambda play: play.yardline + getattr(play, stat) >= cutoff plays = filter(inside('OPP 20', 'receiving_yds'), q.as_plays())
for p in plays:
print p