This is primarily geared towards table rendering.\r
"""\r
for column in self.all():\r
- if column.column.visible:\r
+ if column.visible:\r
yield column\r
\r
def __contains__(self, item):\r
# exceptions are converted into 404s\r
assert_raises(Http404, books.paginate, Paginator, 10, page=9999)\r
assert_raises(Http404, books.paginate, Paginator, 10, page="abc")\r
- \r
+\r
\r
# TODO: all the column stuff might warrant it's own test file\r
def test_columns():\r
"""\r
\r
class BookTable(tables.Table):\r
- id = tables.Column(sortable=False)\r
+ id = tables.Column(sortable=False, visible=False)\r
name = tables.Column(sortable=True)\r
pages = tables.Column(sortable=True)\r
language = tables.Column(sortable=False)\r
\r
assert list(books.columns.sortable()) == [c for c in books.columns if c.sortable]\r
\r
+ # .columns iterator only yields visible columns\r
+ assert len(list(books.columns)) == 3\r
+ # visiblity of columns can be changed at instance-time\r
+ books.columns['id'].visible = True\r
+ assert len(list(books.columns)) == 4\r
+\r
\r
def test_column_order():\r
"""Test the order functionality of bound columns.\r