本文整理汇总了Python中horizon.tabs.TableTab方法的典型用法代码示例。如果您正苦于以下问题:Python tabs.TableTab方法的具体用法?Python tabs.TableTab怎么用?Python tabs.TableTab使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类horizon.tabs
的用法示例。
在下文中一共展示了tabs.TableTab方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_table_tabs
# 需要导入模块: from horizon import tabs [as 别名]
# 或者: from horizon.tabs import TableTab [as 别名]
def test_table_tabs(self):
tab_group = TableTabGroup(self.request)
tabs = tab_group.get_tabs()
# Only one tab, as expected.
self.assertEqual(1, len(tabs))
tab = tabs[0]
# Make sure it's the tab we think it is.
self.assertIsInstance(tab, horizon_tabs.TableTab)
# Data should not be loaded yet.
self.assertFalse(tab._table_data_loaded)
table = tab._tables[MyTable.Meta.name]
self.assertIsInstance(table, MyTable)
# Let's make sure the data *really* isn't loaded yet.
self.assertIsNone(table.data)
# Okay, load the data.
tab.load_table_data()
self.assertTrue(tab._table_data_loaded)
self.assertQuerysetEqual(table.data,
['FakeObject: object_1',
'FakeObject: object_2',
'FakeObject: object_3',
u'FakeObject: öbject_4'],
transform=six.text_type)
context = tab.get_context_data(self.request)
# Make sure our table is loaded into the context correctly
self.assertEqual(table, context['my_table_table'])
# Since we only had one table we should get the shortcut name too.
self.assertEqual(table, context['table'])