def export(post_id, idc): pdf_Channel = db.session.query(Channel).filter(Channel.id == idc).first() if pdf_Channel is not None: channel_config = pdf_Channel.config myPost = db.session.query(Post).filter(Post.id == post_id).first() myPub = Publishing() myPub.description = myPost.description myPub.title = myPost.title run(myPub, channel_config) return redirect(url_for('index'))
def export(post_id, idc): pdf_Channel = db.session.query(Channel).filter(Channel.id == idc).first() if pdf_Channel is not None: channel_config = pdf_Channel.config myPost = db.session.query(Post).filter(Post.id == post_id).first() myPub = Publishing() myPub.description = myPost.description myPub.title = myPost.title run(myPub, channel_config) # TODO get the post information # db.session... TODO # pub = {'description': post.description, 'title': post.title} TODO # config = TODO # run(publishing = pub, channel_config = config) return redirect(url_for('index'))
def export(post_id, idc): pdf_Channel = db.session.query(Channel).filter(Channel.id == idc).first() if pdf_Channel is not None: channel_config = pdf_Channel.config else: flash("PDF channel not found", category='success') return redirect(url_for('index')) myPost = db.session.query(Post).filter(Post.id == post_id).first() myPub = Publishing() myPub.description = myPost.description myPub.title = myPost.title code = run(myPub, channel_config) if code[0].value != StatusCode.OK.value: flash(code[1], category='error') return redirect(url_for('index')) else: # flash("The PDF has successfully been generated.", category='success') return send_from_directory("plugins/pdf/", code[1], as_attachment=True, attachment_filename=code[1])