append_relationships_multiple(books) | append_relationships_multiple(books) | ||||
else: | else: | ||||
# reorder books by book name | # reorder books by book name | ||||
books = sorted(books, key=lambda d: d.__dict__['name']) | |||||
books = sorted(books, key=lambda d: d.__dict__['name'].lower()) | |||||
# get values for filters | # get values for filters | ||||
# practices | # practices | ||||
practices_filter = Resource.query.filter_by(type='practice').with_entities(Resource.id, Resource.name).all() | practices_filter = Resource.query.filter_by(type='practice').with_entities(Resource.id, Resource.name).all() |
append_relationships_multiple(practices) | append_relationships_multiple(practices) | ||||
else: | else: | ||||
# reorder practices by practice name | # reorder practices by practice name | ||||
practices = sorted(practices, key=lambda d: d.__dict__['name']) | |||||
practices = sorted(practices, key=lambda d: d.__dict__['name'].lower()) | |||||
return render_template('resources.html', resources=practices, type='practice', count=count, view=view) | 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 | # route for displaying a single practice based on the ID in the database |
append_relationships_multiple(tools) | append_relationships_multiple(tools) | ||||
else: | else: | ||||
# reorder tools by tools name | # reorder tools by tools name | ||||
tools = sorted(tools, key=lambda d: d.__dict__['name']) | |||||
tools = sorted(tools, key=lambda d: d.__dict__['name'].lower()) | |||||
# get values for filters | # get values for filters | ||||
# practices | # practices | ||||
practices_filter = Resource.query.filter_by(type='practice').with_entities(Resource.id, Resource.name).all() | practices_filter = Resource.query.filter_by(type='practice').with_entities(Resource.id, Resource.name).all() |