@@ -13,6 +13,7 @@ from .resources import * | |||
from .relationships import * | |||
from . import db | |||
import os | |||
from sqlalchemy.sql import func | |||
book = Blueprint('book', __name__) | |||
@@ -21,7 +22,7 @@ book = Blueprint('book', __name__) | |||
def get_books(): | |||
view = request.args.get('view') | |||
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(): | |||
if key != 'view': | |||
if (key == 'practice' and request.args.get(key) != ''): |
@@ -14,6 +14,7 @@ from .relationships import * | |||
from . import db | |||
import os | |||
import markdown | |||
from sqlalchemy.sql import func | |||
practice = Blueprint('practice', __name__) | |||
@@ -21,7 +22,7 @@ practice = Blueprint('practice', __name__) | |||
@practice.route('/practices') | |||
def get_practices(): | |||
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 | |||
count = len(practices) | |||
if view != 'list': |
@@ -13,6 +13,7 @@ from .resources import * | |||
from .relationships import * | |||
from . import db | |||
import os | |||
from sqlalchemy.sql import func | |||
tool = Blueprint('tool', __name__) | |||
@@ -21,7 +22,7 @@ tool = Blueprint('tool', __name__) | |||
def get_tools(): | |||
view = request.args.get('view') | |||
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(): | |||
if key != 'view': | |||
if (key == 'practice' and request.args.get(key) != ''): |