Add basic support for row grid view links

This commit is contained in:
Lance Edgar 2018-01-06 20:02:51 -06:00
parent b2020686f5
commit 22b8643def
2 changed files with 5 additions and 5 deletions

View file

@ -327,16 +327,15 @@ class InventoryBatchView(BatchMasterView):
g.set_type('unit_cost', 'currency')
g.set_type('total_cost', 'currency')
# TODO: i guess row grids don't support this properly yet?
# g.set_link('upc')
# g.set_link('item_id')
# g.set_link('description')
g.set_label('upc', "UPC")
g.set_label('brand_name', "Brand")
g.set_label('status_code', "Status")
g.set_label('previous_units_on_hand', "Prev. On Hand")
g.set_link('upc')
g.set_link('item_id')
g.set_link('description')
def row_grid_extra_class(self, row, i):
if row.status_code == row.STATUS_PRODUCT_NOT_FOUND:
return 'warning'

View file

@ -282,6 +282,7 @@ class MasterView2(MasterView):
'pageable': self.rows_pageable,
'default_pagesize': self.rows_default_pagesize,
'extra_row_class': self.row_grid_extra_class,
'url': lambda obj: self.get_row_action_url('view', obj),
}
if self.has_rows and 'main_actions' not in defaults: