Sidon
Sidon

Reputation: 1366

How to change header of bootstrap4 django-tables2

I defined the table as below

class MyTable(tables.Table):
    class Meta:
        template_name = "django_tables2/bootstrap4.html"
        model = Mymodel
        attrs = {"class": "table table-hover"}

I want to change the table head to make appear light or dark gray, like this.

Upvotes: 0

Views: 1560

Answers (2)

try this one:

attrs = {
        'class': 'table table-hover',
        'thead' : {
            'class': 'thead-dark'
        }

Upvotes: 2

schillingt
schillingt

Reputation: 13731

It's not explicitly in the docs, but judging from how it describes to set th attributes from the Table.Meta.attrs property this is how you do it:

    attrs = {
        'class': 'table table-hover',
        'thead' : {
            'class': 'head-dark'
        }
    }

Upvotes: 0

Related Questions