Ejemplo n.º 1
0
 def post(self, topicId):
     form = ReplyForm()
     topic = Topic.query.filter_by(id=topicId).first_or_404()
     if form.validate_on_submit():
         reply = ReplyModel.post_data(form, topicId)
         page = replies_page(topic.id)
         return redirect(url_for('topic.topic',
                                 topicId=topic.uid,
                                 page=page,
                                 _anchor='reply' + str(reply.id)))
     else:
         if form.errors:
             flash_errors(form)
         page = replies_page(topic.id)
         return redirect(url_for('topic.topic',
                                 topicId=topic.uid,
                                 page=page,
                                 _anchor='replies-content'))
Ejemplo n.º 2
0
def reply(topic, reply):
    page = replies_page(topic.id)
    url = url_for('topic.topic',
                  topicId=topic.uid,
                  page=page,
                  _anchor='reply' + str(reply.id))
    notice = Notice()
    notice.category = 'reply'
    notice.content = {'url': url,
                      'content': reply.content[:100],
                      'title': topic.title}
    notice.rece_id = topic.author_id
    notice.send_user = current_user
    db.session.add(notice)
    db.session.commit()
Ejemplo n.º 3
0
def reply(topic, reply):
    page = replies_page(topic.id)
    url = url_for('topic.topic',
                  topicId=topic.uid,
                  page=page,
                  _anchor='reply' + str(reply.id))
    notice = Notice()
    notice.category = 'reply'
    notice.content = {
        'url': url,
        'content': reply.content[:100],
        'title': topic.title
    }
    notice.rece_id = topic.author_id
    notice.send_user = current_user
    db.session.add(notice)
    db.session.commit()
Ejemplo n.º 4
0
def rereply(topic, reply, rece_username):
    user = User.query.filter_by(username=rece_username).first()
    page = replies_page(topic.id)
    url = url_for('topic.topic',
                  topicId=topic.uid,
                  page=page,
                  _anchor='reply' + str(reply.id))
    notice = Notice()
    notice.category = 'rereply'
    notice.content = {
        'url': url,
        'content': reply.content[:100],
        'title': topic.title
    }
    notice.rece_id = user.id
    notice.send_user = current_user
    db.session.add(notice)
    db.session.commit()