def iheadlines_all(request): news = store.get_headlines('INewsArticle')[:3] sports = store.get_headlines('ISportsArticle')[:3] entertainment = store.get_headlines('EntertainmentArticle')[:3] return HttpResponse(json.dumps({ 'news': news, 'sports': sports, 'entertainment': [a for a in entertainment if a['hash_key'] != '8ad2589bccbe0418a4d57b5fc3e99fd3'], }, default=date_parser), mimetype='application/json' )
def read(request): return render( request, 'read.html', { 'news': store.get_articles('NewsArticle', 40), 'sports': store.get_articles('SportsArticle', 40), 'finance': store.get_articles('FinanceArticle', 40), 'entertainment': store.get_articles('EntertainmentArticle', 40), 'featuredNews': store.get_headlines('NewsArticle', 40), 'featuredSports': store.get_headlines('SportsArticle', 40), 'featuredFinance': store.get_headlines('FinanceArticle', 40), 'featuredEntertainment': store.get_headlines('EntertainmentArticle', 40), })
def headlines(request, tag): cat = parse_tag(tag) articles = store.get_headlines(tag) return HttpResponse(json.dumps({ 'articles': articles, 'cat': cat, }, default=date_parser), mimetype='application/json' )