Commits

Rafał Kos committed 90b699c

Added flash messages to action

Comments (0)

Files changed (3)

homebudget/controllers/accounts.py

 from homebudget.model.form import AccountForm, NewAccountForm
 from homebudget.model import meta, Account
 from homebudget.lib import helpers as h
+from homebudget.lib.helpers import flash
 
 log = logging.getLogger(__name__)
 
             c.form.populate_obj(account)
 
             account.save()
-            
+            flash('Successfully created.', 'success')
             return redirect(h.url(controller='accounts', action='index'))
             
         return render('/accounts/new.html')
             c.form.populate_obj(c.account)
             c.account.save()
 
+            flash('Successfully updated.', 'success')
             return redirect(h.url(controller='accounts', action='index'))
             
         return render('/accounts/edit.html')

homebudget/controllers/companies.py

 
             company.save()
 
-            flash('Successfully created.')
+            flash('Successfully created.', 'success')
             return redirect(h.url(controller='companies', action='index'))
 
         return render('/companies/new.html')
             c.form.populate_obj(c.company)
             c.company.save()
 
-            flash('Successfully saved.')
+            flash('Successfully saved.', 'success')
             return redirect(h.url(controller='companies', action='index'))
 
         return render('/companies/edit.html')

homebudget/controllers/payments.py

 
             payment.save()
 
-            flash(u'Successfuly created')
+            flash(u'Successfuly created', 'success')
             return redirect(h.url(controller='payments', action='index'))
 
         return render('/payments/new.html')
             c.form.populate_obj(c.payment)
             c.payment.save()
 
-            flash(u'Successfuly saved')            
+            flash(u'Successfuly saved', 'success')            
             return redirect(h.url(controller='payments', action='index'))
 
         return render('/payments/edit.html')
         payment = Payment.query.private().filter_by(id=id).first_or_404()
         payment.delete()
 
+        flash(u'Successfuly deleted', 'success')
         return redirect(h.url(controller='payments', action='index'))