Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Customizing the Django Admin Using the Django Admin Your First Admin Customization

Maxim Andreev
Maxim Andreev
24,529 Points

Why would you override the template?

If you can just add

settings.py

ADMIN_SITE_HEADER = "Your new header here"

4 Answers

David Lin
David Lin
35,864 Points

What worked for me:

admin.py

from django.contrib import admin

from . import models


admin.site.register(models.Course)
admin.site.register(models.Text)
admin.site.register(models.Quiz)
admin.site.register(models.MultipleChoiceQuestion)
admin.site.register(models.TrueFalseQuestion)
admin.site.register(models.Answer)

admin.site.site_header = "Learning Site administration"
Chris Komaroff
PLUS
Chris Komaroff
Courses Plus Student 14,198 Points

That's cool, thanks for sharing this settings.py constant, although I can't seem to get it to work. This was just a simple example of how to override the admin template. And I learned how to see Django source code on GitHub which is also very cool.

Kayla Johnson
Kayla Johnson
482 Points

This did not work for me either.

What did work was simply adding: admin.site.site_header = "My site admin" to urls.py