When preparing custom admin pages for an upcoming presentation, I found some inconsistencies in the admin.
One has already been picked up; I’d like some confirmation if the other items are bugs or intentional.
NB. Feel free to create Trac issues for these items if desired and post them in the comments, or I will do so later.
Python—Most admin pages require model._meta to set opts; calling underscore functions is undesirable. Should there be a non-underscore function to retrieve these?
Python—Missing variable module in some views (e.g., model history view has it, change form doesn’t). Especially noticable in the breadcrumbs block.
CSS—Missing padding for ol in base.css (near line 654), selector .module p, .module ul, .module h3, .module h4, .module dl, .module pre.
The _meta attribute was intended to be an internal API, but has shown itself to be extremely useful as a public attribute. It is a well-known exception to the Django attribute naming convention, and is so well-entrenched at this point that it is highly unlikely to ever be changed.
You can redefine it yourself in your applications, but I’d be very surprised to see it become a core change. (Just adding an alias runs the risk of creating conflicts with other packages that already use that name for their own purposes.)
Yeah.It was formalized as public API in Django 1.8: Django 1.8 release notes | Django documentation | Django . Maybe we can interpret the “private” underscore prefix more as “you don’t normally need this, but if you do it’s here…”.
What’s the impact? The breadcrumbs don’t render correctly?
Anyway, nice one spotting these, making a list, finding the exsisting issue, making this post, and any future issues/fixes you submit! Cheers!
It’s mostly an inconsistency that can break custom templates when copying from Django’s templates.
See the difference of these URLs to the model list view, usually the third breadcrumb item (search for <a href="{% url opts|admin_urlname:'changelist' %}">).
Object history template: {{ module_name }}.
Change form template: {{ opts.verbose_name_plural|capfirst }}.