def create_pad(): pad_form = PadForm() if pad_form.validate_on_submit(): pad = Pad(name=pad_form.name.data, user=current_user) db.session.add(pad) db.session.commit() flash('Pad is successfully created', 'success') return redirect(url_for('.home')) return render_template('pads/create.html', form=pad_form)
def create_pad(self, **kwargs): pad = Pad(**kwargs) db.session.add(pad) db.session.commit() return pad