class CountryTable(tables.MemoryTable): name = tables.TextColumn() capital = tables.TextColumn() population = tables.NumberColumn(verbose_name="Population Size") currency = tables.NumberColumn(visible=False, inaccessible=True) tld = tables.TextColumn(visible=False, verbose_name="Domain") calling_code = tables.NumberColumn(name="cc", verbose_name="Phone Ext.")
class CountryTable(tables.MemoryTable): name = tables.TextColumn() capital = tables.TextColumn() population = tables.NumberColumn(verbose_name="Population Size") currency = tables.NumberColumn(visible=False, inaccessible=True) tld = tables.TextColumn(visible=False, verbose_name="Domain") cc = tables.NumberColumn(model_rel="calling_code", verbose_name="Phone Ext.") def render_cc(self, src_row): return "SUCCESS" def render_calling_code(self, src_row): # We should never get here assert False
class CountryTable(tables.ModelTable): capital = tables.TextColumn(verbose_name='Name of capital') projected = tables.Column(verbose_name="Projected Population") class Meta(object): model = Country exclude = ['tld']
class CountryTable(tables.ModelTable): capital = tables.TextColumn(verbose_name='Name of capital') projected = tables.Column(verbose_name="Projected Population") class Meta: model = Country # noqa columns = ['capital']