@@ -36,12 +36,11 @@ def get_books(): | |||
books = books_query.all() | |||
# get number of books | |||
count = len(books) | |||
# reorder books by book name | |||
books = sorted(books, key=lambda d: d.__dict__['name'].lower()) | |||
if view != 'list': | |||
# append relationships to each book | |||
append_relationships_multiple(books) | |||
else: | |||
# reorder books by book name | |||
books = sorted(books, key=lambda d: d.__dict__['name'].lower()) | |||
# get values for filters | |||
# practices | |||
practices_filter = Resource.query.filter_by(type='practice').with_entities(Resource.id, Resource.name).all() |
@@ -25,12 +25,11 @@ def get_practices(): | |||
practices = Resource.query.filter_by(type='practice').order_by(func.random()).all() | |||
# get number of practices | |||
count = len(practices) | |||
# reorder practices by practice name | |||
practices = sorted(practices, key=lambda d: d.__dict__['name'].lower()) | |||
if view != 'list': | |||
# append relationships to each practice | |||
append_relationships_multiple(practices) | |||
else: | |||
# reorder practices by practice name | |||
practices = sorted(practices, key=lambda d: d.__dict__['name'].lower()) | |||
return render_template('resources.html', resources=practices, type='practice', count=count, view=view) | |||
# route for displaying a single practice based on the ID in the database |
@@ -39,12 +39,11 @@ def get_tools(): | |||
tools = tools_query.all() | |||
# get number of tools | |||
count = len(tools) | |||
# reorder tools by tools name | |||
tools = sorted(tools, key=lambda d: d.__dict__['name'].lower()) | |||
if view != 'list': | |||
# append relationships to each tool | |||
append_relationships_multiple(tools) | |||
else: | |||
# reorder tools by tools name | |||
tools = sorted(tools, key=lambda d: d.__dict__['name'].lower()) | |||
# get values for filters | |||
# practices | |||
practices_filter = Resource.query.filter_by(type='practice').with_entities(Resource.id, Resource.name).all() |