fix: add farmOS-style links for Parents column in Land Assets grid
This commit is contained in:
parent
28ecb4d786
commit
3343524325
1 changed files with 15 additions and 1 deletions
|
|
@ -25,6 +25,8 @@ Master view for Assets
|
|||
|
||||
from collections import OrderedDict
|
||||
|
||||
from webhelpers2.html import tags
|
||||
|
||||
from wuttaweb.forms.schema import WuttaDictEnum
|
||||
from wuttaweb.db import Session
|
||||
|
||||
|
|
@ -210,7 +212,19 @@ class AssetMasterView(WuttaFarmMasterView):
|
|||
g.set_filter("archived", model.Asset.archived)
|
||||
|
||||
def render_parents_for_grid(self, asset, field, value):
|
||||
parents = [str(p.parent) for p in asset.asset._parents]
|
||||
parents = asset.asset._parents
|
||||
|
||||
if self.farmos_style_grid_links:
|
||||
links = []
|
||||
for parent in parents:
|
||||
parent = parent.parent
|
||||
url = self.request.route_url(
|
||||
f"{parent.asset_type}_assets.view", uuid=parent.uuid
|
||||
)
|
||||
links.append(tags.link_to(str(parent), url))
|
||||
return ", ".join(links)
|
||||
|
||||
parents = [str(p.parent) for p in parents]
|
||||
return ", ".join(parents)
|
||||
|
||||
def grid_row_class(self, asset, data, i):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue