def add_note(): ''' App za dodavanje bilješke ''' form = AddNoteForm() form.tags.choices = functions.get_all_tags(session['id']) if form.tags.choices is None: form.tags = None if form.validate_on_submit(): note_title = request.form['note_title'] note_markdown = form.note.data note = Markup(markdown.markdown(note_markdown)) try: tags = form.tags.data tags = ','.join(tags) except: tags = None functions.add_note(note_title, note, note_markdown, tags, session['id']) return redirect('/profile/') return render_template('add_note.html', form=form, username=session['username'])
def add_note(): ''' App for adding note ''' form = AddNoteForm() form.tags.choices = functions.get_all_tags(session['id']) if form.tags.choices is None: form.tags = None if form.validate_on_submit(): note_title = request.form['note_title'] note_markdown = form.note.data note = Markup(markdown.markdown(note_markdown, extensions=extensions)) try: tags = form.tags.data tags = ','.join(tags) except: tags = None note_markdown = add_progress(note_markdown) functions.add_note(note_title, note, note_markdown, tags, session['id']) return redirect('/view_notes/') return render_template('add_note.html', form=form, username=session['username'])