Merge "Support Django 3.2 support (3)"
This commit is contained in:
commit
bbaf21c4df
@ -1922,7 +1922,7 @@ class DataTable(object, metaclass=DataTableMetaclass):
|
|||||||
|
|
||||||
def get_columns(self):
|
def get_columns(self):
|
||||||
"""Returns this table's columns including auto-generated ones."""
|
"""Returns this table's columns including auto-generated ones."""
|
||||||
return self.columns.values()
|
return list(self.columns.values())
|
||||||
|
|
||||||
def get_rows(self):
|
def get_rows(self):
|
||||||
"""Return the row data for this table broken out by columns."""
|
"""Return the row data for this table broken out by columns."""
|
||||||
|
@ -425,7 +425,7 @@ class DataTableTests(test.TestCase):
|
|||||||
# but should not contain the excluded column.
|
# but should not contain the excluded column.
|
||||||
# Additionally, auto-generated columns should use the custom
|
# Additionally, auto-generated columns should use the custom
|
||||||
# column class specified on the table.
|
# column class specified on the table.
|
||||||
self.assertQuerysetEqual(self.table.columns.values(),
|
self.assertQuerysetEqual(self.table.get_columns(),
|
||||||
['<MyColumn: multi_select>',
|
['<MyColumn: multi_select>',
|
||||||
'<Column: id>',
|
'<Column: id>',
|
||||||
'<Column: name>',
|
'<Column: name>',
|
||||||
@ -434,7 +434,7 @@ class DataTableTests(test.TestCase):
|
|||||||
'<Column: status>',
|
'<Column: status>',
|
||||||
'<MyColumn: actions>'])
|
'<MyColumn: actions>'])
|
||||||
# Actions (these also test ordering)
|
# Actions (these also test ordering)
|
||||||
self.assertQuerysetEqual(self.table.base_actions.values(),
|
self.assertQuerysetEqual(list(self.table.base_actions.values()),
|
||||||
['<MyBatchAction: batch>',
|
['<MyBatchAction: batch>',
|
||||||
'<MyBatchActionWithHelpText: batch_help>',
|
'<MyBatchActionWithHelpText: batch_help>',
|
||||||
'<MyAction: delete>',
|
'<MyAction: delete>',
|
||||||
@ -472,7 +472,7 @@ class DataTableTests(test.TestCase):
|
|||||||
self.assertEqual(TEST_DATA, self.table.data)
|
self.assertEqual(TEST_DATA, self.table.data)
|
||||||
# The column "restricted" is not rendered because of policy
|
# The column "restricted" is not rendered because of policy
|
||||||
expected_columns = ['<Column: name>']
|
expected_columns = ['<Column: name>']
|
||||||
self.assertQuerysetEqual(self.table.columns.values(), expected_columns)
|
self.assertQuerysetEqual(self.table.get_columns(), expected_columns)
|
||||||
|
|
||||||
@override_settings(POLICY_CHECK_FUNCTION=lambda *args: True)
|
@override_settings(POLICY_CHECK_FUNCTION=lambda *args: True)
|
||||||
def test_table_column_policy_allowed(self):
|
def test_table_column_policy_allowed(self):
|
||||||
@ -480,7 +480,7 @@ class DataTableTests(test.TestCase):
|
|||||||
self.assertEqual(TEST_DATA, self.table.data)
|
self.assertEqual(TEST_DATA, self.table.data)
|
||||||
# Policy check returns True so the column "restricted" is rendered
|
# Policy check returns True so the column "restricted" is rendered
|
||||||
expected_columns = ['<Column: name>', '<Column: restricted>']
|
expected_columns = ['<Column: name>', '<Column: restricted>']
|
||||||
self.assertQuerysetEqual(self.table.columns.values(), expected_columns)
|
self.assertQuerysetEqual(self.table.get_columns(), expected_columns)
|
||||||
|
|
||||||
def test_table_force_no_multiselect(self):
|
def test_table_force_no_multiselect(self):
|
||||||
class TempTable(MyTable):
|
class TempTable(MyTable):
|
||||||
@ -490,7 +490,7 @@ class DataTableTests(test.TestCase):
|
|||||||
row_actions = (MyAction, MyLinkAction,)
|
row_actions = (MyAction, MyLinkAction,)
|
||||||
multi_select = False
|
multi_select = False
|
||||||
self.table = TempTable(self.request, TEST_DATA)
|
self.table = TempTable(self.request, TEST_DATA)
|
||||||
self.assertQuerysetEqual(self.table.columns.values(),
|
self.assertQuerysetEqual(self.table.get_columns(),
|
||||||
['<Column: id>',
|
['<Column: id>',
|
||||||
'<Column: actions>'])
|
'<Column: actions>'])
|
||||||
|
|
||||||
@ -502,7 +502,7 @@ class DataTableTests(test.TestCase):
|
|||||||
row_actions = (MyAction, MyLinkAction,)
|
row_actions = (MyAction, MyLinkAction,)
|
||||||
actions_column = False
|
actions_column = False
|
||||||
self.table = TempTable(self.request, TEST_DATA)
|
self.table = TempTable(self.request, TEST_DATA)
|
||||||
self.assertQuerysetEqual(self.table.columns.values(),
|
self.assertQuerysetEqual(self.table.get_columns(),
|
||||||
['<Column: multi_select>',
|
['<Column: multi_select>',
|
||||||
'<Column: id>'])
|
'<Column: id>'])
|
||||||
|
|
||||||
@ -528,7 +528,7 @@ class DataTableTests(test.TestCase):
|
|||||||
columns = ('id',)
|
columns = ('id',)
|
||||||
table_actions = (MyFilterAction, MyAction, MyBatchAction)
|
table_actions = (MyFilterAction, MyAction, MyBatchAction)
|
||||||
self.table = TempTable(self.request, TEST_DATA)
|
self.table = TempTable(self.request, TEST_DATA)
|
||||||
self.assertQuerysetEqual(self.table.columns.values(),
|
self.assertQuerysetEqual(self.table.get_columns(),
|
||||||
['<Column: multi_select>',
|
['<Column: multi_select>',
|
||||||
'<Column: id>'])
|
'<Column: id>'])
|
||||||
|
|
||||||
@ -538,7 +538,7 @@ class DataTableTests(test.TestCase):
|
|||||||
columns = ('id',)
|
columns = ('id',)
|
||||||
row_actions = (MyAction, MyLinkAction,)
|
row_actions = (MyAction, MyLinkAction,)
|
||||||
self.table = TempTable(self.request, TEST_DATA)
|
self.table = TempTable(self.request, TEST_DATA)
|
||||||
self.assertQuerysetEqual(self.table.columns.values(),
|
self.assertQuerysetEqual(self.table.get_columns(),
|
||||||
['<Column: id>',
|
['<Column: id>',
|
||||||
'<Column: actions>'])
|
'<Column: actions>'])
|
||||||
|
|
||||||
@ -552,7 +552,7 @@ class DataTableTests(test.TestCase):
|
|||||||
row_actions = (MyAction, MyLinkAction,)
|
row_actions = (MyAction, MyLinkAction,)
|
||||||
|
|
||||||
self.table = TempTable(self.request, TEST_DATA)
|
self.table = TempTable(self.request, TEST_DATA)
|
||||||
self.assertQuerysetEqual(self.table.columns.values(),
|
self.assertQuerysetEqual(self.table.get_columns(),
|
||||||
['<Column: multi_select>',
|
['<Column: multi_select>',
|
||||||
'<Column: id>',
|
'<Column: id>',
|
||||||
'<Column: name>',
|
'<Column: name>',
|
||||||
|
@ -210,11 +210,11 @@ class HorizonTests(BaseHorizonTests):
|
|||||||
# Test registering a module with a dashboard that defines panels
|
# Test registering a module with a dashboard that defines panels
|
||||||
# as a panel group.
|
# as a panel group.
|
||||||
cats.register(MyPanel)
|
cats.register(MyPanel)
|
||||||
self.assertQuerysetEqual(cats.get_panel_groups()['other'],
|
self.assertQuerysetEqual(list(cats.get_panel_groups()['other']),
|
||||||
['<Panel: myslug>'])
|
['<Panel: myslug>'])
|
||||||
# Test that panels defined as a tuple still return a PanelGroup
|
# Test that panels defined as a tuple still return a PanelGroup
|
||||||
dogs = horizon.get_dashboard("dogs")
|
dogs = horizon.get_dashboard("dogs")
|
||||||
self.assertQuerysetEqual(dogs.get_panel_groups().values(),
|
self.assertQuerysetEqual(list(dogs.get_panel_groups().values()),
|
||||||
['<PanelGroup: default>'])
|
['<PanelGroup: default>'])
|
||||||
|
|
||||||
# Test registering a module with a dashboard that defines panels
|
# Test registering a module with a dashboard that defines panels
|
||||||
|
Loading…
Reference in New Issue
Block a user