from .relationships import * | from .relationships import * | ||||
from . import db | from . import db | ||||
import os | import os | ||||
from sqlalchemy.sql import func | |||||
book = Blueprint('book', __name__) | book = Blueprint('book', __name__) | ||||
def get_books(): | def get_books(): | ||||
view = request.args.get('view') | view = request.args.get('view') | ||||
resource_type = 'book' | resource_type = 'book' | ||||
books_query = Resource.query.filter_by(type=resource_type) | |||||
books_query = Resource.query.filter_by(type=resource_type).order_by(func.random()) | |||||
for key in request.args.keys(): | for key in request.args.keys(): | ||||
if key != 'view': | if key != 'view': | ||||
if (key == 'practice' and request.args.get(key) != ''): | if (key == 'practice' and request.args.get(key) != ''): |
from . import db | from . import db | ||||
import os | import os | ||||
import markdown | import markdown | ||||
from sqlalchemy.sql import func | |||||
practice = Blueprint('practice', __name__) | practice = Blueprint('practice', __name__) | ||||
@practice.route('/practices') | @practice.route('/practices') | ||||
def get_practices(): | def get_practices(): | ||||
view = request.args.get('view') | view = request.args.get('view') | ||||
practices = Resource.query.filter_by(type='practice').all() | |||||
practices = Resource.query.filter_by(type='practice').order_by(func.random()).all() | |||||
# get number of practices | # get number of practices | ||||
count = len(practices) | count = len(practices) | ||||
if view != 'list': | if view != 'list': |
from .relationships import * | from .relationships import * | ||||
from . import db | from . import db | ||||
import os | import os | ||||
from sqlalchemy.sql import func | |||||
tool = Blueprint('tool', __name__) | tool = Blueprint('tool', __name__) | ||||
def get_tools(): | def get_tools(): | ||||
view = request.args.get('view') | view = request.args.get('view') | ||||
resource_type = 'tool' | resource_type = 'tool' | ||||
tools_query = Resource.query.filter_by(type=resource_type) | |||||
tools_query = Resource.query.filter_by(type=resource_type).order_by(func.random()) | |||||
for key in request.args.keys(): | for key in request.args.keys(): | ||||
if key != 'view': | if key != 'view': | ||||
if (key == 'practice' and request.args.get(key) != ''): | if (key == 'practice' and request.args.get(key) != ''): |