Procházet zdrojové kódy

reordering expanded view by alphabetical

joel
Simon Bowie před 2 roky
rodič
revize
415987b409
3 změnil soubory, kde provedl 6 přidání a 9 odebrání
  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 Zobrazit soubor

books = books_query.all() books = books_query.all()
# get number of books # get number of books
count = len(books) count = len(books)
# reorder books by book name
books = sorted(books, key=lambda d: d.__dict__['name'].lower())
if view != 'list': if view != 'list':
# append relationships to each book # append relationships to each book
append_relationships_multiple(books) append_relationships_multiple(books)
else:
# reorder books by book 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()

+ 2
- 3
web/app/practice.py Zobrazit soubor

practices = Resource.query.filter_by(type='practice').order_by(func.random()).all() practices = Resource.query.filter_by(type='practice').order_by(func.random()).all()
# get number of practices # get number of practices
count = len(practices) count = len(practices)
# reorder practices by practice name
practices = sorted(practices, key=lambda d: d.__dict__['name'].lower())
if view != 'list': if view != 'list':
# append relationships to each practice # append relationships to each practice
append_relationships_multiple(practices) 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) 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

+ 2
- 3
web/app/tool.py Zobrazit soubor

tools = tools_query.all() tools = tools_query.all()
# get number of tools # get number of tools
count = len(tools) count = len(tools)
# reorder tools by tools name
tools = sorted(tools, key=lambda d: d.__dict__['name'].lower())
if view != 'list': if view != 'list':
# append relationships to each tool # append relationships to each tool
append_relationships_multiple(tools) append_relationships_multiple(tools)
else:
# reorder tools by tools 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()

Načítá se…
Zrušit
Uložit