Example #1
0
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)
Example #2
0
    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)
Example #3
0
    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)
Example #4
0
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)
Example #5
0
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)
Example #6
0
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)
Example #7
0
 def test_model_get_articles_old_street(self):
     lat, lon = OLD_STREET_ROUNDABOUT
     print model.get_articles(lat, lon)
Example #8
0
 def GET(self):
   """ Show page """
   i = web.input(q='')
   query = web.websafe(i.q) 
   todos = model.get_articles(query)
   return render.index(todos)
Example #9
0
 def GET(self):
     article = model.get_articles()
     return render.index(article)