Repository navigation
adminsite 0.7.0
pip install adminsite==0.7.0
Two new ways to change what the admin does with records: list_query keeps records off the list without hiding them, and save_record and delete_record replace the write of a save or a delete. Together they make a soft delete a few lines.
Before upgrading:
- A view that already has a method of its own called
list_query,save_recordordelete_recordshould rename it, since adminsite now calls methods by those names.
What changed:
ModelView.list_querykeeps records off the list without hiding them, for deleted or archived records. It narrows the list, its count and filters, the export, "select all matching", the command palette, the dashboard and the pickers on other forms. A record it leaves out still opens from a link and is named there, and a form that holds one keeps it.scope_querystays the way to hide records from a user.ModelView.save_recordandModelView.delete_recorddo the write of a save and of a delete. Override one to store or delete a record your own way, such as a delete that keeps the row and fills in itsdeleted_at. The permission check, the other hooks and the audit log still run around it, and every Delete runsdelete_record: on the record's page, for the ticked rows and through the API.- A save deletes a file it replaces only once the record no longer holds it, so a write or a
before_savethat keeps the old file keeps it in storage too.