Django-admin contrib application is great thing to see & manage application data. But it have limited functionality by design: “The primary purpose of Django’s admin interface is to let people edit data.”. All advanced actions, content managers are asking us from time to time are never going to be implemented in django admin not because its difficult or impossible, but because core concept of django admin is different. So, admin is good to do very basic actions on your data, but is not well suited for writing full content management screens.
Here is some typical tasks which content managers like to solve:
- Define multiple layouts for data: columns list, columns order, data order, applied filters, page configuration. Quickly switch between layouts.
- Run predefined queries on data, analize data flow.
- Fetch data for offline processing.
- Do something on multiple items.
This is very typical setup and it is well suited for every application we develop. Since we don’t want to reinvent wheel every time we write new application, we decided to write some general table management functions and use them between our applications.
Another interesting trick is DataSource definition. Quite often we need to display results of some manually run query (which is impossible to run via ORM). Those queries are mostly requested by content managers, so we either need to make new application to display result of some query every time, or develop some general approach. As a general approach this admintable object can be used.
Every developer gets lazy when you ask about documentation. Here is epydoc results for introspection of source code for models.
- Module hdg.djangoapps.admintable.models * Video tutorial
- Quick Start: the simplest example. * Multiple tables on one screen, raw sql query and DataSource specification * Example of select/apply action