Browse Source

reorder resources by name

joel
Simon Bowie 2 years ago
parent
commit
96520b6244
3 changed files with 6 additions and 0 deletions
  1. +2
    -0
      web/app/book.py
  2. +2
    -0
      web/app/practice.py
  3. +2
    -0
      web/app/tool.py

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

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':

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

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':

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

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':

Loading…
Cancel
Save