def home(): topics, _ = get_all_topics(0) topic_users = User.cache.get_dict({o.user_id for o in topics}) topic_cafes = CafeTopic.get_topics_cafes([o.id for o in topics]) return render_template( 'front/index.html', topics=topics, topic_users=topic_users, topic_cafes=topic_cafes, )
def home(): topics, _ = get_all_topics(0) topic_users = User.cache.get_dict({o.user_id for o in topics}) topic_cafes = CafeTopic.get_topics_cafes([o.id for o in topics]) return render( 'front/index.html', topics=topics, topic_users=topic_users, topic_cafes=topic_cafes, )
def timeline(): cursor = int_or_raise('cursor', 0) if request.args.get('show') == 'all': topics, cursor = get_all_topics(cursor) else: topics, cursor = get_timeline_topics(cursor, current_user.id) topics_cafes = CafeTopic.get_topics_cafes([t.id for t in topics]) data = [] for d in iter_items_with_users(topics): d['cafes'] = topics_cafes.get(d['id']) data.append(d) data = list(iter_topics_with_statuses(data, current_user.id)) return jsonify(data=data, cursor=cursor)