Removed unused forms.
This commit is contained in:
parent
aa1550afe3
commit
cdd776c7b8
@ -19,8 +19,6 @@ from flask.ext.restful import Resource, fields, reqparse, marshal_with_field
|
||||
|
||||
from sqlalchemy.orm.exc import NoResultFound
|
||||
|
||||
from forms.accounts import AccountForm
|
||||
|
||||
from accountant import session_scope, session_aware
|
||||
|
||||
from . import auth
|
||||
@ -154,27 +152,18 @@ class AccountResource(Resource):
|
||||
assert (id not in kwargs or kwargs.id is None
|
||||
or kwargs.id == account_id)
|
||||
|
||||
account_form = AccountForm()
|
||||
try:
|
||||
account = Account.get(session, account_id)
|
||||
except NoResultFound:
|
||||
return None, 404
|
||||
|
||||
if account_form.validate():
|
||||
try:
|
||||
account = Account.get(session, account_id)
|
||||
except NoResultFound:
|
||||
return None, 404
|
||||
# SQLAlchemy objects ignore __dict__.update() with merge.
|
||||
for k, v in kwargs.items():
|
||||
setattr(account, k, v)
|
||||
|
||||
# SQLAlchemy objects ignore __dict__.update() with merge.
|
||||
for k, v in kwargs.items():
|
||||
setattr(account, k, v)
|
||||
session.merge(account)
|
||||
|
||||
session.merge(account)
|
||||
|
||||
return account
|
||||
else:
|
||||
return json.dumps({
|
||||
'ok': False,
|
||||
'error_type': 'validation',
|
||||
'errors': account_form.errors
|
||||
})
|
||||
return account
|
||||
|
||||
|
||||
api_api.add_resource(AccountListResource, '/accounts')
|
||||
|
@ -1,9 +0,0 @@
|
||||
from flask_wtf import Form
|
||||
from wtforms import DecimalField, IntegerField, StringField
|
||||
|
||||
class AccountIdForm(Form):
|
||||
id = IntegerField()
|
||||
|
||||
class AccountForm(AccountIdForm):
|
||||
name = StringField()
|
||||
authorized_overdraft = DecimalField()
|
Loading…
Reference in New Issue
Block a user