def test_override_column_class_names():
 class MyTable(tables.Table, ):
  population = tables.Column(verbose_name=u'Population')
  def get_column_class_names(self, classes_set, bound_column):
   classes_set.add((u'prefix-%s' % bound_column.name))
   return classes_set
 TEST_DATA = [{u'name': u'Belgium', u'population': 11200000}, {u'name': u'Luxembourgh', u'population': 540000}, {u'name': u'France', u'population': 66000000}]
 html = MyTable(TEST_DATA).as_html(build_request())
 assert (u'<td class="prefix-population">11200000</td>' in html)

def test_override_column_class_names ( ) : class MyTable ( tables . Table , ) : population = tables . Column ( verbose_name = u'Population' ) def get_column_class_names ( self , classes_set , bound_column ) : classes_set . add ( ( u'prefix-%s' % bound_column . name ) ) return classes_set TEST_DATA = [ { u'name' : u'Belgium' , u'population' : 11200000 } , { u'name' : u'Luxembourgh' , u'population' : 540000 } , { u'name' : u'France' , u'population' : 66000000 } ] html = MyTable ( TEST_DATA ) . as_html ( build_request ( ) ) assert ( u'<td class="prefix-population">11200000</td>' in html )
we control the output of css class names for a column by overriding get_column_class_names .