當前位置: 首頁>>代碼示例>>Python>>正文


Python tables.Row方法代碼示例

本文整理匯總了Python中horizon.tables.Row方法的典型用法代碼示例。如果您正苦於以下問題:Python tables.Row方法的具體用法?Python tables.Row怎麽用?Python tables.Row使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在horizon.tables的用法示例。


在下文中一共展示了tables.Row方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: allowed

# 需要導入模塊: from horizon import tables [as 別名]
# 或者: from horizon.tables import Row [as 別名]
def allowed(self, request, share=None):
        if share:
            # Row button
            return (share.status.upper() in DELETABLE_STATES and
                    not getattr(share, 'has_snapshot', False))
        # Table button. Always return 'True'.
        return True 
開發者ID:openstack,項目名稱:manila-ui,代碼行數:9,代碼來源:tables.py

示例2: allowed

# 需要導入模塊: from horizon import tables [as 別名]
# 或者: from horizon.tables import Row [as 別名]
def allowed(self, request, share_group=None):
        if share_group:
            # Row button
            return (share_group.status.lower() in ('available', 'error'))
        # Table button. Always return 'True'
        return True 
開發者ID:openstack,項目名稱:manila-ui,代碼行數:8,代碼來源:tables.py

示例3: test_table_rendering

# 需要導入模塊: from horizon import tables [as 別名]
# 或者: from horizon.tables import Row [as 別名]
def test_table_rendering(self):
        self.table = MyTable(self.request, TEST_DATA)
        # Table actions
        table_actions = self.table.render_table_actions()
        resp = http.HttpResponse(table_actions)
        self.assertContains(resp, "table_search", 1)
        self.assertContains(resp, "my_table__filter__q", 1)
        self.assertContains(resp, "my_table__delete", 1)
        self.assertContains(resp, 'id="my_table__action_delete"', 1)
        # Row actions
        row_actions = self.table.render_row_actions(TEST_DATA[0])
        resp = http.HttpResponse(row_actions)
        self.assertContains(resp, "<li", 3)
        self.assertContains(resp, "my_table__delete__1", 1)
        self.assertContains(resp, "my_table__toggle__1", 1)
        self.assertContains(resp, "/auth/login/", 1)
        self.assertContains(resp, "ajax-modal", 1)
        self.assertContains(resp, 'id="my_table__row_1__action_delete"', 1)
        # Whole table
        resp = http.HttpResponse(self.table.render())
        self.assertContains(resp, '<table id="my_table"', 1)
        self.assertContains(resp, '<th ', 8)
        self.assertContains(resp, 'id="my_table__row__1"', 1)
        self.assertContains(resp, 'id="my_table__row__2"', 1)
        self.assertContains(resp, 'id="my_table__row__3"', 1)
        update_string = "action=row_update&amp;table=my_table&amp;obj_id="
        self.assertContains(resp, update_string, 3)
        self.assertContains(resp, "data-update-interval", 3)
        # Verify no table heading
        self.assertNotContains(resp, "<h3 class='table_title'")
        # Verify our XSS protection
        self.assertContains(resp, '<a href="http://example.com/" '
                                  'data-tip="click for dialog" '
                                  'data-type="modal dialog" '
                                  'class="link-modal">'
                                  '&lt;strong&gt;evil&lt;/strong&gt;</a>', 1)
        # Hidden Title = False shows the table title
        self.table._meta.hidden_title = False
        resp = http.HttpResponse(self.table.render())
        self.assertContains(resp, "<h3 class='table_title'", 1)

        # Filter = False hides the search box
        self.table._meta.filter = False
        table_actions = self.table.render_table_actions()
        resp = http.HttpResponse(table_actions)
        self.assertContains(resp, "table_search", 0) 
開發者ID:CiscoSystems,項目名稱:avos,代碼行數:48,代碼來源:tables.py


注:本文中的horizon.tables.Row方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。