def crt_room(movie): created_room = str(uuid.uuid4()) movie = Movie.query.filter_by(public_id=movie).first() host = current_user.name room = Room() room.unique_id = created_room room.host = host room.admin = True db.session.add(room) db.session.commit() return redirect( url_for('raw.watching', movie=movie.name, room=created_room))
def create_room(current_user, movie): try: created_room = str(uuid.uuid4()) movie = Movie.query.filter_by(public_id=movie).first() host = current_user.name room = Room() room.unique_id = created_room room.host = host room.admin = True db.session.add(room) db.session.commit() return jsonify({ "message": f"Room {created_room} created by {host} ", "movie name": movie.name }) except: return jsonify({"message": "Cannot find movie id"})
def create_room(movie): created_room = str(uuid.uuid4()) movie = Movie.query.filter_by(public_id=movie).first() host = current_user.name room = Room() room.unique_id = created_room room.host = host room.admin = True db.session.add(room) db.session.commit() '''return jsonify( { "message": f"Room {created_room} created by {host} ", "movie": movie.movies, "movie name": movie.name } )''' return redirect( url_for('chat.watch', movie=movie.public_id, room=created_room))