示例#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))
示例#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))
示例#3
0
 def create(self):
     form = MonkeyForm(request.form)
     return render_template('monkey_create.html', form=form)
示例#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)
示例#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)
示例#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)