Fix typo, was missing models to call the Distribution object
Add missing import
Fix typo: session isn't defined, we need to call flask.g.db