Show the index page or any an offset of it.
(request, page)
| 14 | @expose("/", defaults={"page": 1}) |
| 15 | @expose("/page/<int:page>") |
| 16 | def index(request, page): |
| 17 | """Show the index page or any an offset of it.""" |
| 18 | days = [] |
| 19 | days_found = set() |
| 20 | query = Entry.query.order_by(Entry.pub_date.desc()) |
| 21 | pagination = Pagination(query, PER_PAGE, page, "index") |
| 22 | for entry in pagination.entries: |
| 23 | day = date(*entry.pub_date.timetuple()[:3]) |
| 24 | if day not in days_found: |
| 25 | days_found.add(day) |
| 26 | days.append({"date": day, "entries": []}) |
| 27 | days[-1]["entries"].append(entry) |
| 28 | return render_template("index.html", days=days, pagination=pagination) |
| 29 | |
| 30 | |
| 31 | @expose("/about") |
nothing calls this directly
no test coverage detected