def get(self): user = users.get_current_user() if user: if users.is_current_user_admin(): template_values = {} polls = Poll.gql("ORDER BY name DESC") template_values["polls"] = polls apoll = ActivePoll.get_or_insert("key", mkey="activepoll") try: currentpoll = apoll.poll.name except AttributeError: currentpoll = "" #unable to retrieve current poll template_values["currentpoll"] = currentpoll.strip() import os path = os.path.join(os.path.dirname(__file__), 'admin.html') self.response.out.write(template.render(path, template_values)) else: self.abort(403) else: self.redirect(users.create_login_url(self.request.uri))
def get(self): self.render('admindex.html', polls=Poll.gql('ORDER BY year DESC'))