Пример #1
0
def domain_today():
    data = Domain.get_all()
    result = []
    total = 0
    for item in data:
        article_new = Article.count(item['domain'], today=True)
        result.append({'domain': item['domain'], 'article_num': article_new})
        total += article_new
    result = sorted(result, key=lambda k: k['article_num'], reverse=True)
    return jsonify(article_total=total, data=result)
Пример #2
0
def domain_today():
    data = Domain.get_all()
    result = []
    total = 0
    for item in data:
        article_new = Article.count(item['domain'], today=True)
        result.append({
            'domain': item['domain'],
            'article_num': article_new
        })
        total += article_new
    result = sorted(result, key=lambda k: k['article_num'], reverse=True)
    return jsonify(article_total=total, data=result)
Пример #3
0
def domain_all():
    data = Domain.get_all()
    total = sum(item['article_num'] for item in data)
    data = sorted(data, key=lambda k: k['article_num'], reverse=True)
    return jsonify(article_total=total, data=data)
Пример #4
0
def domain_all():
    data = Domain.get_all()
    total = sum(item['article_num'] for item in data)
    data = sorted(data, key=lambda k: k['article_num'], reverse=True)
    return jsonify(article_total=total, data=data)