Allow easy overriding of admin rendering helpers.
|Reported by:||Adam Avramov||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
The classes in question -- the ones that reside in
django.contrib.admin.helpers -- play a fundamental role in rendering admin forms; yet their entire existence is woefully undocumented, and the code only references them in passing in the middle of complex view code, effectively turning a crucial part of the rendering process into a black box, and thus precluding a whole lot of customization opportunities which would otherwise be accessible to the (ostensibly) few of us who love
contrib.admin and use it as a go-to framework for the more formulaic CRUD projects out there.
The one minor contribution I've made to the Django codebase so far -- namely merging
changeform_view on a nice Cardiff Sunday -- unintentionally made overriding helpers slightly easier, by introducing the
get_inline_formsets method, where
InlineAdminFormSet could be replaced with a custom subclass without much ado. Replacing
AdminForm, however, still requires copying the big blob of code that is
changeform_view and modifying it in place -- hardly good OOP practice.
Adding a way to specify custom helper classes would require only trivial changes to the
admin codebase, so if anyone else thinks I've got a point, let me know and I can come up with a patch/PR.