Fixed #282964: 'data' may point to a callable attribute while still leaving the colum...
[django-tables2.git] / tests / test_models.py
index c7f94bc6290f05eb3a32dbea1ac6f51ffd5323fe..61f97b03d69c7ece376b53e4b84ad34775e14f39 100644 (file)
@@ -258,6 +258,7 @@ def test_column_data():
 \r
     class CountryTable(tables.ModelTable):\r
         name = tables.Column(data=lambda d: "hidden")\r
+        tld = tables.Column(data='example_domain', name="domain")\r
         default_and_data = tables.Column(data=lambda d: None, default=4)\r
         class Meta:\r
             model = Country\r
@@ -270,6 +271,10 @@ def test_column_data():
     # to correct model column; can be used to rewrite what is displayed\r
     countries.order_by = 'name'\r
     assert countries.order_by == ('name',)\r
+    # [bug 282964] this trick also works if the callable is an attribute\r
+    # and we refer to it per string, rather than giving a function object\r
+    countries.order_by = 'domain'\r
+    assert countries.order_by == ('domain',)\r
 \r
 def test_pagination():\r
     """Pretty much the same as static table pagination, but make sure we\r