Fixed grid join map bug.

This commit is contained in:
Lance Edgar 2013-09-20 15:49:48 -07:00
parent 685b391dd2
commit 23e08d0bb0
2 changed files with 4 additions and 9 deletions

View file

@ -274,11 +274,11 @@ def filter_query(query, config, filter_map, join_map):
for key in config:
if key.startswith('include_filter_') and config[key]:
field = key[15:]
if field in join_map and field not in joins:
query = join_map[field](query)
joins.append(field)
value = config.get(field)
if value:
if field in join_map and field not in joins:
query = join_map[field](query)
joins.append(field)
fmap = filter_map[field]
filt = fmap[config['filter_type_'+field]]
query = filt(query, value)

View file

@ -73,11 +73,6 @@ class ProductsGrid(SearchableAlchemyGridView):
# q = q.outerjoin(Vendor)
# return q
def join_vendor_any(q):
return q.outerjoin(ProductCost,
ProductCost.product_uuid == Product.uuid)\
.outerjoin(Vendor)
return {
'brand':
lambda q: q.outerjoin(Brand),
@ -96,7 +91,7 @@ class ProductsGrid(SearchableAlchemyGridView):
# 'vendor':
# join_vendor,
'vendor_any':
join_vendor_any,
lambda q: q.outerjoin(ProductCost, ProductCost.product_uuid == Product.uuid).outerjoin(Vendor),
'code':
lambda q: q.outerjoin(ProductCode),
}