Python horizon.tables.Row() Examples
The following are 3
code examples of horizon.tables.Row().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
horizon.tables
, or try the search function
.
Example #1
Source File: tables.py From manila-ui with Apache License 2.0 | 5 votes |
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
Example #2
Source File: tables.py From manila-ui with Apache License 2.0 | 5 votes |
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
Example #3
Source File: tables.py From avos with Apache License 2.0 | 4 votes |
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&table=my_table&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">' '<strong>evil</strong></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)