Scaffolding

So you want an admin for your data? Rarely does “data” map cleanly to “admin. An event table might have country_id and start_timestamp columns. What you really want is a layer of abstraction in between. Some scaffolds are better than others.

PHPMyAdmin is probably the original, or at least the only one still going. It’s about as low-level as you can get considering you’re working on the tables themselves. It’s got some support for foreign relationships and helpers for other field types, but beyond that you’re on your own. No validating models, no support or fancy tools.

Adminer comes a little closer but it’s still pretty much a UI over a table.

Django was one of the first projects I used that had a fully featured CRUD automatically generated from its models. This is probably still the best to this date. Validation straight off the models, relationship helpers. You can even extend and/or override various components.

It still has some limitations. Built originally for a newsroom it assumes all users have all permissions. Unfortunately for many larger clients this just isn’t a tenable position. There are plugins which extend and add this functionality, along with revisions, workflows etc. And adding pages for non-crud elements is still a bit trickier than the auto-crud stuff, not to mention setting up Django itself isn’t fun.

So what does a scaffold need:

  • It needs to support a permission-driven user system. Some can edit, some can view, a few can publish. Users can edit only their own pages, or pages within a section.
  • On a similar vein, it needs the capacity (but maybe not the capability) to support workflows. User X submits an article and User Y has to approve it (along with subsequent changes, something that is often missed).
  • Tables and forms shouldn’t map back to a single table. Relationships are the core of any RDBMS and despite what the NoSQL domain would have you think they’re not going away. This isn’t just your basic dropdowns on a foreign ID. Tag autosuggest, event timeslots, all require managing relationships.
  • Revisions. A bigger one, and one that is handled at a much lower level especially when dealing with relationships, but revisions must bubble up through the UI. This ties in very nicely to…
  • Previews! Forget previewing the model’s page as well. What we need is the ability to preview the entire site. How does this new article look when it’s appeared on the listing page?
  • Which again leads on to a new trend; separating administration from presentation. The admin site should sit distinct from the front-end, providing an API (code, memory, or http/etc doesn’t matter). Caching policies for the front-end site are often at odds with any admin and ensuring a clean split makes everything easier.