jundymek
jundymek

Reputation: 1043

Django - format labels in admin panel

I have a label "Inactive sites" in my django admin:

class InactiveSite(Site):
    class Meta:
        proxy = True
        verbose_name_plural = 'Inactive sites (' + str(Site.objects.filter(is_active=False).count()) + ')'

I would like to format "Inactive sites" (change color, font size, etc.). How can I do that?

Upvotes: 1

Views: 230

Answers (1)

djangonaut
djangonaut

Reputation: 7778

You can override Django's template for the admin page and include your own css file (preferred way) or directly add it to the html.

You can use the developer tools of chrome or firefox to identify what selector you need. In Chrome CTRL+SHIFT+C and then click on the link text. At the moment I only have a modified admin, for me the css selector is: #admin-home > ul > li > ul > li > a

See here: https://docs.djangoproject.com/en/1.10/ref/contrib/admin/#overriding-admin-templates

The answer here has a code sample: https://stackoverflow.com/a/37317429/640916

Upvotes: 1

Related Questions