Commit 47080aeb authored by Tom Kedem's avatar Tom Kedem

added support for remote hybrid properties filters.

parent d7ee730a
......@@ -190,7 +190,12 @@ def get_hybrid_properties(model):
def is_hybrid_property(model, attr_name):
return attr_name in get_hybrid_properties(model)
names = attr_name.split('.')
last_model = model
for i in range(len(names)-1):
last_model = getattr(last_model, names[i]).property.argument
last_name = names[-1]
return last_name in get_hybrid_properties(last_model)
def is_relationship(attr):
......@@ -199,9 +204,3 @@ def is_relationship(attr):
def is_association_proxy(attr):
return hasattr(attr, 'extension_type') and attr.extension_type == ASSOCIATION_PROXY
def get_association_proxy_column_name(attr):
# TODO find a better way to get the name
name, = [key for key, value in inspect(attr.owning_class).all_orm_descriptors.items() if value is attr]
return name
......@@ -617,6 +617,7 @@ class ModelView(BaseModelView):
is_hybrid_property = tools.is_hybrid_property(self.model, name)
if is_hybrid_property:
column = attr
column.key = name.split('.')[-1]
else:
columns = tools.get_columns_for_field(attr)
......@@ -636,7 +637,8 @@ class ModelView(BaseModelView):
if not isinstance(name, string_types):
visible_name = self.get_column_name(name.property.key)
else:
visible_name = self.get_column_name(name)
names = name.split('.')
visible_name = ' / '.join([self.get_column_name(names_item) for names_item in names])
type_name = type(column.type).__name__
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment