We now know the basics of using DataObjects as Pages from Part 1 of this tutorial. In part 2, we are now going to look at taking this further and creating a basic product catalogue with products that are DataObjects managed via the ModelAdmin interface. This tutorial will also serve as an introduction to ModelAdmin it self, which is an extremely powerful CRUD (Create, Read, Update, Delete) manager for any type of DataObject, whether used as pages or not.

It's been a while since we published the DataObject as Pages series of tutorials, which have proved to be particularly popular. At Aab Web we use those techniques regularly as a way to allow our clients to mange large amounts of flat content or content that is distributed in multiple places throughout a site. Although the final implementations in each project are often varied and bespoke, they all start with the basics outlined in those tutorials, so it made sense for us to build a starting point to work from (and include some more complex features at the same time). That starting point is this module, catchily entitled: DataObject as Pages.

Often you will want to add some extra features to your Model Admin interface. Luckily it's pretty straightforward when you know how! In this tutorial we are going to add a simple 'Duplicate' button for our managed Model.

Sometimes, in ModelAdmin, we want to be able to have a different default sort.

Specifically, like in cases where a has_one is the preferred sorting. For example, we have a warehouse. In our DataObjects, we have the object "Lanes", has_many Products. And we have Products, has_one "Lanes". When we're browsing our Products in the admin, we want to have them default sorted by their Lane, not their name.

Just saying default_sort = 'Lanes'; sadly does not do the job. It'll give you reddish-screens and stuff. Which is not what we like.