else: | else: | ||||
kwargs = {'type': type, key: request.args.get(key)} | kwargs = {'type': type, key: request.args.get(key)} | ||||
books = Resource.query.filter_by(**kwargs).all() | books = Resource.query.filter_by(**kwargs).all() | ||||
# reorder books by book name | |||||
books = sorted(books, key=lambda d: d.__dict__['name']) | |||||
# get number of books | # get number of books | ||||
count = len(books) | count = len(books) | ||||
if view != 'list': | if view != 'list': |
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').all() | ||||
# reorder practices by practice name | |||||
practices = sorted(practices, key=lambda d: d.__dict__['name']) | |||||
# get number of practices | # get number of practices | ||||
count = len(practices) | count = len(practices) | ||||
if view != 'list': | if view != 'list': |
else: | else: | ||||
kwargs = {'type': type, key: request.args.get(key)} | kwargs = {'type': type, key: request.args.get(key)} | ||||
tools = Resource.query.filter_by(**kwargs).all() | tools = Resource.query.filter_by(**kwargs).all() | ||||
# reorder tools by tool name | |||||
tools = sorted(tools, key=lambda d: d.__dict__['name']) | |||||
# get number of tools | # get number of tools | ||||
count = len(tools) | count = len(tools) | ||||
if view != 'list': | if view != 'list': |