예제 #1
0
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)
예제 #2
0
 def create_pad(self, **kwargs):
     pad = Pad(**kwargs)
     db.session.add(pad)
     db.session.commit()
     return pad