Skip to content

Commit

Permalink
more resiliant grid
Browse files Browse the repository at this point in the history
  • Loading branch information
mdipierro committed Nov 8, 2024
1 parent 1246cc0 commit dd5e703
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions py4web/utils/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ def compute(row, col=col):
if col.represent:
value = col.represent(value, row)
# deal with download links in special manner if no representation
if col.type == "upload" and value and col.download_url:
if col.type == "upload" and value and hasattr(col, "download_url"):
value = A("download", _href=col.download_url(value))
return value

Expand Down Expand Up @@ -639,7 +639,7 @@ def compute(row, name=str(col)):
redirect(self.endpoint)

elif self.action == "delete" and self.is_deletable(record):
db(db[self.tablename].id == self.record_id).delete()
db(db[self.tablename]._id == self.record_id).delete()

referrer = parse_referer(request)
url = self.endpoint + "/select"
Expand Down Expand Up @@ -680,7 +680,7 @@ def compute(row, name=str(col)):
if self.param.groupby or self.param.left:
# need groupby fields in select to get proper count
self.total_number_of_rows = len(
db(query).select(db[self.tablename].id, **select_params)
db(query).select(db[self.tablename]._id, **select_params)
)
else:
self.total_number_of_rows = db(query).count()
Expand Down

0 comments on commit dd5e703

Please sign in to comment.