Pynuts is a Flask extension simplifying the implementation of the generic views of your app.
It allows you to:
- implement and configure CRUD view functions in a few lines, using your database schema.
- secure your application by easily managing user permissions using the request context.
- generate HTML, ReST and PDF documents containing data from any model instance you created.
- manage different versions of these document with an embedded git repository.
- drastically reduce the amount of code to write and development time by focusing on your application logic and deferring the boring parts to Pynuts.
Let's compare the code you have to write, without and with Pynuts, to implement a basic view inserting a model instance into database:
app.route('/employee/add', methods=('GET', 'POST')) def add_employee(): form = EmployeeForm() if form.validate_on_submit(): employee = Employee() form.populate_obj(employee) db.session.add(employee) db.session.commit() return redirect(url_for( 'read_employee', employee_id=employee.employee_id)) else: return render_template(url_for('add_employee'))
@EmployeeView.create_page @app.route('/employee/add', methods=('GET', 'POST')) def add_employee(): return EmployeeView().create('create_employee.html.jinja2')