Skip to content

Commit

Permalink
Add pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
Charl1996 committed Jun 27, 2024
1 parent bcd11c9 commit 72e3af4
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion corehq/apps/hqadmin/reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,10 @@ def rows(self):

return rows

@property
def total_records(self):
return len(self.ucr_domains)

@property
def ucr_domains(self):
return USER_CONFIGURABLE_REPORTS.get_enabled_domains()
Expand Down Expand Up @@ -458,6 +462,7 @@ class UCRDataLoadReport(AdminReport):
emailable = False
exportable = False
default_rows = 10
ajax_pagination = True

def __init__(self, request, *args, **kwargs):
self.table_data = UCRRebuildRestrictionTable(
Expand All @@ -471,4 +476,16 @@ def headers(self):

@property
def rows(self):
return self.table_data.rows
start = self.pagination.start
end = self.pagination.start + self.pagination.count
return self.table_data.rows[start:end]

@property
def total_records(self):
return self.table_data.total_records

@property
def shared_pagination_GET_params(self):
return [
{'name': 'ucr_rebuild_restriction', 'value': self.request.GET.get('ucr_rebuild_restriction')}
]

0 comments on commit 72e3af4

Please sign in to comment.