[Django]-Humanizing django-tables2 output?

4👍

You can import the intcomma template filter, and define a custom render method for the column that uses it.

from django.contrib.humanize.templatetags.humanize import intcomma

class ProductMaxIPPortEldCountMonthlyTable(tables.Table):                      
    ip_count = tables.Column()

    def render_ip_count(self, value):
        return intcomma(value)

Leave a comment