Advanced Django Admin: Nested Drag & Drop, M2M Matrix, AI Test Suite

A collection of custom Django admin interfaces built for CareSolace, a mental health care management platform. These go well beyond the default admin and into territory where most teams would reach for a separate frontend.

The most complex piece is a questions & answers tree editor for configuring an AI billing assistant’s decision logic. Each tree is a self-referencing hierarchy: a root question branches into answers, which lead to either result nodes (with CPT procedure codes) or further questions, nested arbitrarily deep. Built with django-nested-inline, but heavily customized. Out of the box, django-nested-inline only supports drag & drop within the same nesting level, and doesn’t support self-referencing foreign keys at all. I worked around both limitations: you can drag a subtree from any depth and drop it onto any “Add another” link at any other level, with the dragged content collapsing cleanly during the move.

Another piece is a license matrix widget: a single admin page for managing which provider license types (LCSW, Psych, AMFT, etc.) can bill which CPT codes. Rows are procedure codes, columns are license types, all rendered as a checkbox grid with three tools that work on both rows and columns depending on cursor position: check all, uncheck all, and copy (which applies an entire row or column to another). This replaced the need to manage hundreds of individual M2M relationships across separate admin pages, turning it into a single visual interface editable by non-technical staff.

 

Also built the admin section for a versioned configuration system for an AI Billing Assistant that runs on AWS Lambda functions. The configuration can be exported as YAML, imported with validation (including license mismatch detection against the matrix). The section also includes the ability to configure and run regression test suites against the AI Billing Assistant. Test suites run 200+ cases via Celery, using several parallel runners. The LLM responses are compared against pre-validated expected outputs, with pass/fail tracking, execution time per case, and an overall statistical score is calculated.

 

Technologies: Django, django-nested-inline, Celery, AWS Lambda, Vanilla.JS