From 25c8edd81c1dda27358582c4c131fe57259cd6b3 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Tue, 23 Apr 2019 22:56:38 -0500 Subject: [PATCH] Allow config to specify grid "page size" options --- tailbone/grids/core.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tailbone/grids/core.py b/tailbone/grids/core.py index ec6e99be..f10dd3e6 100644 --- a/tailbone/grids/core.py +++ b/tailbone/grids/core.py @@ -1053,7 +1053,15 @@ class Grid(object): checked=self.checked(item)) def get_pagesize_options(self): - # TODO: Make configurable or something... + + # use values from config, if defined + options = self.request.rattail_config.getlist('tailbone', 'grid.pagesize_options') + if options: + options = [int(size) for size in options + if size.isdigit()] + if options: + return options + return [5, 10, 20, 50, 100, 200] def has_static_data(self):