Opened 11 years ago
Closed 11 years ago
#21378 closed Bug (fixed)
Outdated way to change admin site header in tutorial02
Reported by: | Vajrasky Kok | Owned by: | Vajrasky Kok |
---|---|---|---|
Component: | Documentation | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description
https://docs.djangoproject.com/en/dev/intro/tutorial02/
In the development version (1.7 if you come from the future) of tutorial02, the way to change admin site header ("Django administration") is wrong. It tells us to override the template and:
"Then, just edit the file and replace the generic Django text with your own site’s name as you see fit."
But there is no "generic Django text".
I think the proper way is to subclass admin site and change site_header class attribute.
Change History (8)
comment:1 by , 11 years ago
Has patch: | set |
---|---|
Status: | new → assigned |
comment:2 by , 11 years ago
Summary: | In 1.7 (master) version of tutorial02, the way to change admin site header is wrong → Outdated way to change admin site header in tutorial02 |
---|---|
Triage Stage: | Unreviewed → Accepted |
The documentation was outdated by https://github.com/django/django/commit/a962286b74f1e8c8cb19fb45a057800da8c2fb56 commit which replaced hardcoded "Django administrator" header text with a new Site.site_header
attribute.
comment:4 by , 11 years ago
There is a way to change site header with shorter code. Instead of subclassing AdminSite, we can set site_header attribute of default admin.site directly.
admin.site.site_header = "Cute Cat Entreprise" admin.site.register(Poll, PollAdmin)
But I am not sure whether this is Djangonic or not.
Okay, why don't we wait other people's (especially core developers) comments about this. Once we agree what to do, I'll update PR. Thanks for the review!
comment:5 by , 11 years ago
My 2 cents: since the tutorial is aimed at new users, I would avoid adding such a long part just to change the header. Finding an easier way to do it would be better, or maybe having the explanation somewhere else and having a link to it?
comment:6 by , 11 years ago
I suggest keeping the existing text of the tutorial and just briefly pointing out the alternative site_header
attribute at the end in one sentence. e.g. "We used this approach to teach you how to override templates. In an actual project, you can probably simply use the site_header attribute."
comment:7 by , 11 years ago
Okay, thanks for the input and here is the revised PR: https://github.com/django/django/pull/1899
comment:8 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Here is the preliminary PR.
https://github.com/django/django/pull/1855