Aufban
Aufban

Reputation: 33

Extend Admin template CSS in django

On my django site I tried unsuccesfully to change the color and a little of CSS of the header bar in the django admin site. I don't want to change anything else.

The template I currently have:

{% extends "admin/base_site.html" %}
{% block extrastyle %}
<style>
    #header{ background-color: #a67d3d; border-bottom: solid 3px #f5deb3; }
</style>
{% endblock %}

This modifies the colors but makes the rest of the content blank. Navigating through the urls I managed to go beyond the main screen only to find the base colors (the blue I'm trying to change) and everything else working.

I also tried using: {% extends "admin/base.html" %} to no avail.

Is there a way to do this without creating a completly new Admin instance?

Upvotes: 1

Views: 1614

Answers (1)

scharette
scharette

Reputation: 9977

This probably as to do with the fact that your override code is not at the right place. So,

  1. Go under your project directory and create a folder called templates
  2. Add another directory called admin
  3. Create a file called base_site.html and add your code

So, the code you posted in your question should reside in,

YourProject/templates/admin/base_site.html

Then, the override should appear correclty.

Upvotes: 2

Related Questions