def track_topic(topic_id, slug=None): topic = Topic.query.filter_by(id=topic_id).first_or_404() current_user.track_topic(topic) current_user.save() return redirect(topic.url)