Various grid and form tweaks.

This commit is contained in:
Lance Edgar 2015-02-09 13:20:34 -06:00
parent 3257010a7e
commit eedbc5fb9a
4 changed files with 14 additions and 12 deletions

View file

@ -34,7 +34,8 @@ __all__ = ['AssociationProxyField']
def AssociationProxyField(name, **kwargs):
"""
Returns a ``Field`` class which is aware of SQLAlchemy association proxies.
Returns a FormAlchemy ``Field`` class which is aware of association
proxies.
"""
class ProxyField(Field):
@ -45,10 +46,7 @@ def AssociationProxyField(name, **kwargs):
self.renderer.deserialize())
def value(model):
try:
return getattr(model, name)
except AttributeError:
return None
return getattr(model, name, None)
kwargs.setdefault('value', value)
return ProxyField(name, **kwargs)