The topic of this week’s [short] missive is the venerable Django admin app. You know it, you use it, you love it.
But when you’re building and maintaining Django sites, how much should you rely on the admin site to deliver customer features?
The Django admin app gives you almost out-of-the-box visibility and access to your site data. It’s a thin application layer between you the user and the database tables.
It’s a little bit like an old Access application in this regard - and I mean that in a good way.
If all you want to do is CRUD, you can go a long way with the admin as-is! It’s an excellent base on which to build content management systems of various stripes.
The admin app is not a foundation for building deep functionality in a highly customized app.
Yes, there are hooks for adding custom functionality, from custom filters to bulk actions. And like any other templates in a standalone Django app, the admin template can be overridden. We’ve made use of all of these things ourselves quite successfully.
However the constraints imposed in the admin app itself can be quite, well, imposing. The result for features that extend beyond the admin’s clearly defined customization hooks often border on hacky, especially when they entail template and design customization.
It’s a little bit like an old Access application in this regard - and this time I mean that in a bad way.
Building progressively more complex applications on top of the admin app is tempting for two reasons: (1) it’s very easy to get started and (2) it’s also easy to get away with - at first.
The real cost comes down the road when it’s time to fix or extend an existing feature, or an upgrade reveals some unexpected version dependencies.
There are no hard and fast rules for using the app, but here are a few heuristics to help decide what kind of customization is warranted:
For other smaller sites or prototypes where significant user facing development is not a requirement, it may be more trouble to add a user interface outside of the admin app.
The lesson is not, “don’t build on top of Django’s admin app” but rather: “know what you’re staking your features on”.
Briefly yours,
Ben
Learn from more articles like this how to make the most out of your existing Django site.