def create(self): if request.method == 'POST': if request.form.get('message'): Note.create( user=auth.get_logged_in_user(), message=request.form['message'], ) next = request.form.get('next') or self.dashboard_url() return redirect(next)
def create(): user = auth.get_logged_in_user() if request.method == 'POST' and request.form["content"]: Note.create( user=user, content=request.form["content"], ) flash('Your note has been created') return redirect(url_for('getNotes')) return render_template('create.html')
async def new_note(sid, data): sid_data = state.sid_map[sid] user = sid_data["user"] room = sid_data["room"] location = sid_data["location"] if Note.get_or_none(uuid=data["uuid"]): logger.warning( f"{user.name} tried to overwrite existing note with id: '{data['uuid']}'" ) return Note.create(uuid=data["uuid"], title=data["title"], text=data["text"], user=user, room=room)
async def new_note(sid: str, data: Dict[str, Any]): pr: PlayerRoom = game_state.get(sid) if Note.get_or_none(uuid=data["uuid"]): logger.warning( f"{pr.player.name} tried to overwrite existing note with id: '{data['uuid']}'" ) return Note.create( uuid=data["uuid"], title=data["title"], text=data["text"], user=pr.player, room=pr.room, location=pr.active_location, )
def homepage(): notes = Note.select() if request.method == 'POST': if request.form.get('content'): note = Note.create(content=request.form['content']) rendered = render_template('note.html', note=note) return render_template('homepage.html', notes=notes) return render_template('homepage.html', notes=notes)
def homepage(): if request.method == 'POST': if request.form.get('content'): note = Note.create(content=request.form['content']) rendered = render_template('note.html', note=note) return jsonify({'note': rendered, 'success': True}) notes = Note.public().limit(50) return jsonify({'success': False})
def homepage(): if request.method == 'POST': if request.form.get('content'): note = Note.create(content=request.form['content']) rendered = render_template('note.html', note=note) return redirect(url_for('homepage')) return jsonify({'success': False}) notes = Note.public().limit(50) return render_template('homepage.html', notes=notes)
def homepage(): if not session.get('logged_in'): return redirect(url_for('login')) if request.method == 'POST': if request.form.get('content'): note = Note.create(content=request.form['content']) flash('New entry posted') return redirect(url_for('homepage')) notes = Note.public().paginate(get_page(), 50) return render_template('homepage.html', notes=notes)
def note_add(): if request.method == 'POST' and request.form['message']: user = auth.get_logged_in_user() message = Note.create( user=user, message=request.form['message'], title=request.form['title'], ) message.save() flash('You submited data!') return redirect(url_for('note_list')) return render_template('note_add.html')
def create_note(self, notebook_id, is_markdown_enabled): if not notebook_id: return False if not self.detail_panel.IsShown(): self.detail_panel.Show() note = Note.create(title='', notebook_id=notebook_id, is_markdown=is_markdown_enabled) self.list_panel.add_new_note(note) self.show_note(note) self.detail_panel.focus_title() self.nav_panel.note_tree.update_selected_notebook_count(1) wx.CallAfter(pub.sendMessage, "note.created.callback", note=note)
def new_note(): note = Note.create( title="", content="", ) categories = utils.categories() return flask.render_template( "edit.html", note=note, categories=categories, new=True )
def homepage(): if request.method == 'POST': if request.form.get('content'): # New note note = Note.create(content = request.form['content']) # Make a note panel and jsonify rendered = render_template('note.html', note = note) return jsonify({'note': rendered, 'success': True}) # no content, return failure return jsonify({'success': False}) notes = Note.public().limit(50) return render_template('homepage.html', notes = notes)
def homepage(): if request.method == 'POST': #create a new note in the db if request.form.get('content'): note = Note.create(content=request.form['content']) # Render a single note panel and return the HTML. rendered = render_template('note.html', note=note) return jsonify({'note': rendered, 'success': True}) return jsonify({'success': False}) notes = Note.public().paginate(get_page(), 50) return render_template('homepage.html', notes=notes)
def homepage(): if request.method == 'POST': print('/ request method is post') if request.form.get('content'): print('/ request metho is post,content is ', request.form['content']) note = Note.create(content=request.form['content']) rendered = render_template('note.html', note=note) return jsonify({'note': rendered, 'success': True}) return jsonify({'success': False}) print('/ request method is get') notes = Note.public().paginate(get_page(), 50) return render_template('homepage.html', notes=notes)
def homepage(): if request.method == 'POST': if request.form.get('content'): # Create a new note in the db. note = Note.create(content=request.form['content']) # Render a single note panel and return the HTML. rendered = render_template('note.html', note=note) return jsonify({'note': rendered, 'success': True}) # If there's no content, indicate a failure. return jsonify({'success': False}) notes = Note.public().limit(50) return render_template('homepage.html', notes=notes)
def index(): form = AddNoteForm() user = get_current_user() if form.validate_on_submit(): if form.note.data: # Create a new note in db note = Note.create(user=user.id, content=form.note.data, timestamp=datetime.now()) # Render a single panel with new note and return the HTML rendered = render_template('note.html', note=note) return jsonify({'note': rendered, 'success': True}) # If there no content in form, indicate a failure return jsonify({'success': False}) notes = Note.user_notes(user) return render_template('index.html', user=user, title='%s notes' % user.username, notes=notes, form=form)
def create_note(): user = authenticate(request) if user is None: response.status = 401 return {'error': 'Authentication credentials not valid.'} body = request.body.read() errors = note_schema.validate(json.loads(body)) if errors: response.status = 400 return {'errors': errors} note_dict = note_schema.loads(body).data note = Note.create(title=note_dict.get('title', ''), content=note_dict.get('content', ''), owner=user.id) return note_schema.dumps(note).data
def homepage(): """ Displays the list of notes and creates new ones """ if request.method == 'POST': if request.form.get('content'): # Create a new note in the db. note = Note.create(title=request.form['title'], content=request.form['content'], categories=request.form['categories']) # Render a single note panel and return the HTML. rendered = render_template('note.html', note=note) return jsonify({'note': rendered, 'success': True}) # If there's no content, indicate a failure. return jsonify({'success': False}) # For now it will only show the 50 most recent notes, # for us not to worry with pagination. notes = Note.public().limit(50) return render_template('homepage.html', notes=notes)
def _create_note(self, _): if self.note_tree.notebook_id: note = Note.create(notebook_id=self.note_tree.notebook_id) pub.sendMessage('note.created', note=note)