Browse Source

reordering expanded view by alphabetical

joel
Simon Bowie 1 year ago
parent
commit
415987b409
3 changed files with 6 additions and 9 deletions
  1. +2
    -3
      web/app/book.py
  2. +2
    -3
      web/app/practice.py
  3. +2
    -3
      web/app/tool.py

+ 2
- 3
web/app/book.py View File

@@ -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()

+ 2
- 3
web/app/practice.py View File

@@ -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

+ 2
- 3
web/app/tool.py View File

@@ -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()

Loading…
Cancel
Save