def topic_recent_week_page(page_num): datas = db_topics.Topics().get_topics_by_page(page_num=page_num, page_size=15, last_week=True) pagination = page_html(total_count=db_topics.Topics().get_topic_count(), page_size=15, current_page=page_num, url='topic-recent-week/page') today_topic = db_topics.Topics().get_topic_by_id( db_topic_recommend.Topic_recommend().get_today_recommend_topic_id()) db_topic_recommend.Topic_recommend().test_and_update_today_recommend_topic() if is_login(): user = db_users.Users().get_user(session['username']) focus_topics = db_topic_focus.Topic_focus().get_user_focus_topics(user.uid) return render_template('login/login-recent_week_topics.html', user=user, datas=datas, pagination=pagination, url='topic/page', today_topic=today_topic, focus_topics=focus_topics) return render_template('login/login-recent_week_topics.html', datas=datas, pagination=pagination, url='topic/page', today_topic=today_topic)
def all_users(): hot_users = db_users.Users().get_top5_users() pagination = page_html(total_count=db_users.Users().get_users_count(), page_size=15, current_page=1, url='all_users/page') if is_login(): user = db_users.Users().get_user(session['username']) return render_template('login/login-all_users.html', user=user, all_users_datas=db_users.Users().get_all_users(), pagination=pagination, hot_users=hot_users) return render_template('all_users.html', all_users_datas=db_users.Users().get_all_users(), pagination=pagination, hot_users=hot_users)
def wait_reply_page(page_num): hot_topics = db_topics.Topics().get_top5_topics() hot_users = db_users.Users().get_top5_users() pagination = page_html(total_count=db_questions.Questions().get_wait_reply_questions_count(), page_size=15, current_page=page_num, url='wait-reply/page') if is_login(): user = db_users.Users().get_user(session['username']) return render_template('login/login-wait_reply.html', user=user, datas=get_wait_reply_datas(page_num=page_num, page_size=15), pagination=pagination, hot_users=hot_users, hot_topics=hot_topics) return render_template('wait_reply.html', datas=get_wait_reply_datas(page_num=page_num, page_size=15), pagination=pagination, hot_users=hot_users, hot_topics=hot_topics)
def hot(): hot_topics = db_topics.Topics().get_top5_topics() hot_users = db_users.Users().get_top5_users() pagination = page_html(total_count=db_questions.Questions().get_questions_count(), page_size=15, current_page=1, url='hot/page') if is_login(): user = db_users.Users().get_user(session['username']) return render_template('login/login-hot_questions.html', user=user, datas=get_hot_datas(page_num=1, page_size=15), pagination=pagination, hot_topics=hot_topics, hot_users=hot_users) return render_template('hot_questions.html', datas=get_hot_datas(page_num=1, page_size=15), pagination=pagination, hot_topics=hot_topics, hot_users=hot_users)
def discover(page_num): hot_topics = db_topics.Topics().get_top5_topics() hot_users = db_users.Users().get_top5_users() pagination = page_html(total_count=db_questions.Questions().get_questions_count(), page_size=15, current_page=page_num, url='discover/page') if is_login(): user = db_users.Users().get_user(session['username']) focus_topics = db_topic_focus.Topic_focus().get_user_focus_topics(user.uid) return render_template('login/login-discover.html', user=user, datas=get_discover_datas(page_num=page_num, page_size=15), pagination=pagination, hot_topics=hot_topics, hot_users=hot_users, focus_topics=focus_topics) return render_template('index.html', datas=get_discover_datas(page_num=page_num, page_size=15), pagination=pagination, hot_topics=hot_topics, hot_users=hot_users)