def board_modify_form(uuid): db = DB() rows = db.get_board(uuid) if session: if session['id'] == rows['id']: db = DB() rows = db.get_board(uuid) db = files_db() files = db.get_files(uuid) return render_template('board_modify.html', session=session, data=rows, files=files) return render_template("alert_msg.html", msg="잘못된 접근 입니다.")
def board_modify(): send_data = OrderedDict() data = dict() if request.method == "POST": data['uuid'] = request.form['uuid'] data['title'] = request.form['subject'] data['contents'] = request.form['content'] send_data['status'] = 'error' db = DB() rows = db.get_board(data['uuid']) if session: if session['id'] == rows['id']: if db.modify_board(data): send_data['status'] = 'ok' files = request.files.getlist('file') if files: error = f_upload(data['uuid'], files) if error: db.delete_board(data['uuid']) send_data['msg'] = error else: send_data['status'] = 'fail' else: send_data['status'] = 'permission error' return jsonify(send_data)
def board_show(uuid, page): db = DB() rows = db.get_board(uuid) del db mydb = files_db() downs = mydb.get_files(uuid) del mydb db = Comments_DB() total_cnt = db.get_comment_cnt(uuid) per_page = 10 pagination = Pagination(page, per_page=per_page, total_count=total_cnt) if page != 1: offset = per_page * (page - 1) else: offset = 0 comments = db.get_comments_list(per_page, offset, uuid) if request.method == "POST": hits = request.form['hits'] db.hits_add(uuid, hits) rows['hits'] = hits del db if session: if session['id'] == rows['id']: return render_template("board_show.html", session=session, downs=downs, rows=rows, pagination=pagination, comments=comments, user_check=True) return render_template("board_show.html", rows=rows, pagination=pagination, downs=downs, comments=comments)