Exemple #1
0
 def dispatch_request(self):
     form = WalletForm(request.form)
     if request.method == 'POST' and form.validate():
         newwallet = Wallet(**form.data)
         session.add(newwallet)
         session.commit()
         flash("%s: Wallet added" % newwallet.label)
         return redirect(url_for("wallet.wallet_list"))
     return render_template("wallet/wallet/add.html", form=form)
Exemple #2
0
 def dispatch_request(self):
     form = WalletForm(request.form)
     if request.method == 'POST' and form.validate():
         newwallet = Wallet(**form.data)
         session.add(newwallet)
         session.commit()
         flash("%s: Wallet added" % newwallet.label)
         return redirect(url_for("wallet.wallet_list"))
     return render_template("wallet/wallet/add.html", form=form)
Exemple #3
0
 def dispatch_request(self, id):
     super(WalletEditView, self).dispatch_request(id)
     form = WalletForm(request.form, self.wallet)
     if request.method == 'POST' and form.validate():
         form.populate_obj(self.wallet)
         session.commit()
         flash(u"%s: Wallet updated" % self.wallet.label, 'info')
         return redirect(url_for("wallet.wallet_list"))
     return render_template("wallet/wallet/edit.html", wallet=self.wallet,
                            form=form)
Exemple #4
0
 def dispatch_request(self, id):
     super(WalletEditView, self).dispatch_request(id)
     form = WalletForm(request.form, self.wallet)
     if request.method == 'POST' and form.validate():
         form.populate_obj(self.wallet)
         session.commit()
         flash(u"%s: Wallet updated" % self.wallet.label, 'info')
         return redirect(url_for("wallet.wallet_list"))
     return render_template("wallet/wallet/edit.html",
                            wallet=self.wallet,
                            form=form)