Wellfire Interactive // Expertise for established Django SaaS applications

Just how much should you use the Django admin? (This Old Pony #42)

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?


What it is

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.

What it is not

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.

The why and why not

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:

  • If the features can be provided by a few custom admin actions and/or filters, then stick with the admin
  • If these features are sufficiently complex that they cannot be explained to a Django novice then you may be outgrowing the admin for your use case
  • If you’re building custom views that use custom templates that happen to be served over the admin URL routes, then you can probably stick with the admin
  • If you’re extensively customizing admin templates, reconsider using the admin app for your use case And of course, a few caveats. For API-centric sites or other sites with minimal user facing components, the admin makes a lot of sense as a home for any other kind of editable content or even just content viewing. A few minor updates and a workflow log model has a fully read-only interface to enable customer support.

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,

Learn from more articles like this how to make the most out of your existing Django site.