def get(self): """Show the competitions page.""" user_id, user = self.get_user() comps = [] for c in Competition.all(): month = c.month month_word = MONTHS[month] user_photo = False if user: user_photo = Photo.competition_user(c, user) is not None comps.append( ( # month, c.key.id(), month_word, c.year, c.title, c.description, c.get_status(), user_photo, ) ) data = {"page_title": "Competitions", "user": user, "comps": comps, "months": MONTHS} self.render("competitions.html", **data)
def get(self): """Show the competition admin page.""" user_id, user = self.get_user() if not user or not user.admin: self.redirect("/") comps = Competition.all() data = { "page_title": "Competition Admin", "user": user, "comps": [(c.key.id(), c) for c in comps], "months": MONTHS, } self.render("competitions-admin.html", **data)