[Answered ]-How to specify table class with django_tables2

1👍

You can add class attributes to the table in the Table’s Meta class. Just add what classes you want on the table, make sure you’re loading the css file in the webpage, and bootstrap css will do the rest.

More info here:
https://django-tables2.readthedocs.io/en/latest/pages/custom-rendering.html#css

class PersonTable(tables.Table):

    class Meta:
        model = player_hardware
        attrs = {"class": "table table-sm table-striped"}
        template_name = "django_tables2/bootstrap-responsive.html"
👤Ben

Leave a comment