Various grid and form tweaks.
This commit is contained in:
parent
3257010a7e
commit
eedbc5fb9a
4 changed files with 14 additions and 12 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue