예제 #1
0
def topictracker():
    page = request.args.get("page", 1, type=int)
    topics = current_user.tracked_topics.\
        outerjoin(TopicsRead,
                  db.and_(TopicsRead.topic_id == Topic.id,
                          TopicsRead.user_id == current_user.id)).\
        add_entity(TopicsRead).\
        order_by(Topic.last_updated.desc()).\
        paginate(page, flaskbb_config['TOPICS_PER_PAGE'], True)

    # bulk untracking
    if request.method == "POST":
        topic_ids = request.form.getlist("rowid")
        tmp_topics = Topic.query.filter(Topic.id.in_(topic_ids)).all()

        for topic in tmp_topics:
            current_user.untrack_topic(topic)
        current_user.save()

        flash(
            _("%(topic_count)s topics untracked.",
              topic_count=len(tmp_topics)), "success")
        return redirect(url_for("forum.topictracker"))

    return render_template("forum/topictracker.html", topics=topics)
예제 #2
0
파일: views.py 프로젝트: djsilcock/flaskbb
def topictracker():
    page = request.args.get("page", 1, type=int)
    topics = current_user.tracked_topics.\
        outerjoin(TopicsRead,
                  db.and_(TopicsRead.topic_id == Topic.id,
                          TopicsRead.user_id == current_user.id)).\
        add_entity(TopicsRead).\
        order_by(Topic.last_updated.desc()).\
        paginate(page, flaskbb_config['TOPICS_PER_PAGE'], True)

    # bulk untracking
    if request.method == "POST":
        topic_ids = request.form.getlist("rowid")
        tmp_topics = Topic.query.filter(Topic.id.in_(topic_ids)).all()

        for topic in tmp_topics:
            current_user.untrack_topic(topic)
        current_user.save()

        flash(_("%(topic_count)s topics untracked.",
                topic_count=len(tmp_topics)), "success")
        return redirect(url_for("forum.topictracker"))

    return render_template("forum/topictracker.html", topics=topics)
예제 #3
0
def untrack_topic(topic_id, slug=None):
    topic = Topic.query.filter_by(id=topic_id).first_or_404()
    current_user.untrack_topic(topic)
    current_user.save()
    return redirect(topic.url)
예제 #4
0
파일: views.py 프로젝트: delida/flaskbb
def untrack_topic(topic_id, slug=None):
    topic = Topic.query.filter_by(id=topic_id).first_or_404()
    current_user.untrack_topic(topic)
    current_user.save()
    return redirect(topic.url)