def index(page): # Return all articles and display them in the index template num_posts = model.count_articles() pagination = Pagination(page, num_posts) articles = model.get_articles(page) return render_template('index.html', articles=articles, pagination=pagination)
def GET(self, lat, lon): articles = model.get_articles(lat, lon) # Always return 5 articles to simplify the UI articles = articles[:5] web.header('Content-Type', 'application/json') response = {"articles": articles} return json.dumps(response)
def GET(self, lat, lon): articles = model.get_articles(lat, lon) # Always return 5 articles to simplify the UI articles = articles[:5] web.header('Content-Type', 'application/json') response = { "articles": articles } return json.dumps(response)
def list(tag, page): # List all articles for a given tag and display them num_posts = model.count_articles(tag) articles = model.get_articles(page, tag=tag) return render_template('list.html', articles=articles)
def test_model_get_articles_old_street(self): lat, lon = OLD_STREET_ROUNDABOUT print model.get_articles(lat, lon)
def GET(self): """ Show page """ i = web.input(q='') query = web.websafe(i.q) todos = model.get_articles(query) return render.index(todos)
def GET(self): article = model.get_articles() return render.index(article)