Exemplo n.º 1
0
def create_book():
	form = AddEntityForm(request.form)
	if not form.validate():
		return render_template('books.html', books = Book.query.all(), add_form = form)

	book = create(Book, form.text.data)
	return redirect(url_for('edit_book', id = book.id))
Exemplo n.º 2
0
def create_author():
    form = AddEntityForm(request.form)

    if not form.validate():
        return render_template("authors.html", authors=Author.query.all(), add_form=form)

    create(Author, form.text.data)
    return redirect(url_for("authors_list"))
Exemplo n.º 3
0
def create_author():	
	form = AddEntityForm(request.form)
	
	if not form.validate():
		return render_template('authors.html', authors = Author.query.all(), add_form = form)
	
	author = create(Author, form.text.data)
	flash(constants.FLASH_MESSAGE_AUTHOR_CREATED.format(name = author.name))		
	return redirect(url_for('authors_list'))