Shell access to User

master
Steven Loria 11 years ago
parent 7ede47885f
commit 32ae81ec35
  1. 2
      {{cookiecutter.app_name}}/README.rst
  2. 5
      {{cookiecutter.app_name}}/manage.py

@ -33,7 +33,7 @@ To open the interactive shell, run ::
python manage.py shell python manage.py shell
By default, you will have access to ``app`` and ``db``. By default, you will have access to ``app``, ``db``, and the ``User`` model.
Running Tests Running Tests

@ -7,6 +7,7 @@ from flask.ext.script import Manager, Shell, Server
from flask.ext.migrate import MigrateCommand from flask.ext.migrate import MigrateCommand
from {{cookiecutter.app_name}}.app import create_app from {{cookiecutter.app_name}}.app import create_app
from {{cookiecutter.app_name}}.user.models import User
from {{cookiecutter.app_name}}.settings import DevConfig, ProdConfig from {{cookiecutter.app_name}}.settings import DevConfig, ProdConfig
from {{cookiecutter.app_name}}.database import db from {{cookiecutter.app_name}}.database import db
@ -20,9 +21,9 @@ TEST_CMD = "nosetests"
def _make_context(): def _make_context():
'''Return context dict for a shell session so you can access '''Return context dict for a shell session so you can access
app and db by default. app, db, and the User model by default.
''' '''
return {'app': app, 'db': db} return {'app': app, 'db': db, 'User': User}
@manager.command @manager.command
def test(): def test():

Loading…
Cancel
Save