def create_note(): data = request.get_json() title = data['title'] content = data['note'] notebook_title = data['notebook'] notebook = Notebook.find_by_title(notebook_title, get_jwt_identity()) notebook.increment_note() new_note = Note(notebook._id, notebook.title, title, content, get_jwt_identity()) new_note.save_to_mongo() return jsonify({"msg": "note created"}), 201
def quick_note(): data = request.get_json() title = "" content = data['note'] url = data['url'] notebook = Notebook.find_by_title('inbox', get_jwt_identity()) notebook.increment_note() new_note = Note(notebook._id, notebook.title, title, content, get_jwt_identity(), url) new_note.save_to_mongo() return jsonify({"msg": "note created"}), 201
def create_note(notebook_id): if request.method == 'POST': title = request.form['title'] content = "" notebook = Notebook.find_by_id(notebook_id) notebook.increment_note() new_note = Note(notebook_id, notebook.title, title, content, session['username']) new_note.save_to_mongo() # return redirect(url_for('.get_notes', notebook_id=notebook_id)) return redirect(url_for('.edit_note', note_id=new_note._id)) return render_template('notes/new_note.html')
def create_note(): try: if request.method == 'POST': share = request.form['inputGroupSelect01'] if share == '0': return render_template( '/notes/create_note.html', error_msg= "You did not selected an Share label. Please select an Share label." ) if share == '1': share = True share_only_with_users = False else: share = False share_only_with_users = True title = request.form['title'] content = request.form['content'] author_email = session['email'] author_nickname = User.find_by_email(author_email).nick_name note_for_save = Note(title=title, content=content, author_email=author_email, shared=share, author_nickname=author_nickname, share_only_with_users=share_only_with_users) note_for_save.save_to_mongo() return redirect(url_for('.user_notes')) return render_template('/notes/create_note.html') except: error_msg = traceback.format_exc().split('\n') Error_obj = Error_(error_msg=''.join(error_msg), error_location='create_note creating note') Error_obj.save_to_mongo() return render_template('error_page.html', error_msgr='Crashed during saving your note...')