Browse Source

fixed ordering with pagination

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

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

intro_text = markdown.markdown(intro_text) intro_text = markdown.markdown(intro_text)


# DATABASE QUERY # DATABASE QUERY
books_query = Resource.query.filter_by(type=resource_type).order_by(Resource.name)
books_query = Resource.query.filter_by(type=resource_type)


# FILTERING # FILTERING
for key in request.args.keys(): for key in request.args.keys():
books_query = books_query.filter_by(**kwargs) books_query = books_query.filter_by(**kwargs)


# finalise the query and add pagination # finalise the query and add pagination
books = books_query.paginate(page=page, per_page=5)
books = books_query.order_by(Resource.name).paginate(page=page, per_page=5)


# FILTERS MENU # FILTERS MENU
# get values for filter menu dropdowns # get values for filter menu dropdowns

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

intro_text = markdown.markdown(intro_text) intro_text = markdown.markdown(intro_text)


# DATABASE QUERY # DATABASE QUERY
practices_query = Resource.query.filter_by(type=resource_type).order_by(Resource.name)
practices_query = Resource.query.filter_by(type=resource_type)


# temporarily removing incomplete practices from main list # temporarily removing incomplete practices from main list
practices_query = Resource.query.filter( practices_query = Resource.query.filter(
)) ))


# finalise the query and add pagination # finalise the query and add pagination
practices = practices_query.paginate(page=page, per_page=5)
practices = practices_query.order_by(Resource.name).paginate(page=page, per_page=5)


# POST-FILTERING PROCESSING # POST-FILTERING PROCESSING
# if view is 'expanded' then append relationships # if view is 'expanded' then append relationships

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

intro_text = markdown.markdown(intro_text) intro_text = markdown.markdown(intro_text)


# DATABASE QUERY # DATABASE QUERY
tools_query = Resource.query.filter_by(type=resource_type).order_by(Resource.name)
tools_query = Resource.query.filter_by(type=resource_type)


# FILTERING # FILTERING
for key in request.args.keys(): for key in request.args.keys():
tools_query = tools_query.filter_by(**kwargs) tools_query = tools_query.filter_by(**kwargs)


# finalise the query and add pagination # finalise the query and add pagination
tools = tools_query.paginate(page=page, per_page=5)
tools = tools_query.order_by(Resource.name).paginate(page=page, per_page=5)


# FILTERS MENU # FILTERS MENU
# get values for filter menu dropdowns # get values for filter menu dropdowns

Loading…
Cancel
Save