async def create_board(self, ctx): """handler to create a new board""" sent_data = ctx.sent_data ws = ctx.extensions.get('ws') jwt = ctx.services.get('jwt') user = ctx.user snowflake = ctx.services.get('snowflake') new_board_uid = await snowflake() new_board = Board(uid=new_board_uid, name=sent_data['name'], owner_id=user.uid) new_board.save() owner_role = Role(uid=await snowflake(), name='Owner', permissions=8) everyone_role = Role(uid=await snowflake(), name='everyone', permissions=104324161) general_channel = Channel(uid=await snowflake(), name='general', type=0, topic='general discussion', position=0) owner_role.save() everyone_role.save() general_channel.save() everyone_role.parents.connect(owner_role) new_board.roles.connect(owner_role) new_board.roles.connect(everyone_role) new_board.subscribers.connect(user, {'role': owner_role.uid}) new_board.channel_children.connect(general_channel) await ws.event(EventType.BOARD_CREATE, new_board.subscribers, board=new_board) return ctx.respond(jsonify(new_board, requester=user))
def read(id): board = Board() board = board.query.get(id) board.count = db.session.query(func.max(Board.count)).one()[0] if board.count == None: board.count = 0 else: board.count += 1 db.session.add(board) db.session.commit() return render_template("read.html", board=board)
def read(id): board = Board() board = board.query.get(id) board.count = db.session.query(func.max(Board.count), ).one()[0] if board.count == None: board.count = 0 else: board.count += 1 db.session.add(board) db.session.commit() return render_template("read.html", board=board)
def w_success(): board = Board() if request.method == "POST": title = request.form['title'] text = request.form['textarea'] board.title = title board.text = text board.writer = username() board.num = db.session.query(func.max(Board.num), ).one()[0] if board.num == None: board.num = 1 else: board.num += 1 db.session.add(board) db.session.commit() return redirect(url_for("list"))
def w_success(): board = Board() if request.method == "POST": title = request.form["title"] text = request.form["textarea"] board.title = title board.text = text board.writer = username() board.num = db.session.query(func.max(Board.num)).one()[0] if board.num == None: board.num = 1 else: board.num += 1 db.session.add(board) db.session.commit() return redirect(url_for("list"))