fix: include grid filters for all column properties of model class
by default anyway. previous logic started from `grid.columns` and then only included column properties, but now we start from the model class itself and let sa-utils figure out the default list
This commit is contained in:
parent
c2efc1cd1a
commit
84ab931081
3 changed files with 22 additions and 12 deletions
|
@ -982,6 +982,17 @@ class TestGrid(WebTestCase):
|
|||
self.assertEqual(filters['value'], 42)
|
||||
self.assertEqual(myfilters['value'], 42)
|
||||
|
||||
# filters for all *true* columns by default, despite grid.columns
|
||||
with patch.object(mod.Grid, 'make_filter'):
|
||||
# nb. filters are MagicMock instances
|
||||
grid = self.make_grid(model_class=model.User,
|
||||
columns=['username', 'person'])
|
||||
filters = grid.make_backend_filters()
|
||||
self.assertIn('username', filters)
|
||||
self.assertIn('active', filters)
|
||||
# nb. relationship not included by default
|
||||
self.assertNotIn('person', filters)
|
||||
|
||||
def test_make_filter(self):
|
||||
model = self.app.model
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue