Exemplo n.º 1
0
 def post(self):
     form = MonkeyForm(request.form)
     if not form.validate():
         return render_template('monkey_create.html', form=form)
     else:
         monkey = MonkeyViewHelper().create_monkey(form)
         return redirect(url_for('MonkeysView:get', id=monkey.id))
Exemplo n.º 2
0
 def post(self):
     form = MonkeyForm(request.form)
     if not form.validate():
         return render_template("monkey_create.html", form=form)
     else:
         monkey = MonkeyViewHelper().create_monkey(form)
         return redirect(url_for("MonkeysView:get", id=monkey.id))
Exemplo n.º 3
0
 def create(self):
     form = MonkeyForm(request.form)
     return render_template('monkey_create.html', form=form)
Exemplo n.º 4
0
 def update(self, id):
     monkey = Monkey.query.get(id)
     form = MonkeyForm(request.form, monkey)
     if form.validate():
         MonkeyViewHelper().update_monkey(monkey, form)
     return render_template('monkey_view.html', form=form, monkey=monkey)
Exemplo n.º 5
0
 def get(self, id):
     monkey = Monkey.query.get(id)
     form = MonkeyForm(request.form, monkey)
     return render_template('monkey_view.html', monkey=monkey, form=form)
Exemplo n.º 6
0
 def update(self, id):
     monkey = Monkey.query.get(id)
     form = MonkeyForm(request.form, monkey)
     if form.validate():
         MonkeyViewHelper().update_monkey(monkey, form)
     return render_template("monkey_view.html", form=form, monkey=monkey)