JavaScript customizations in the admin

JavaScript customizations in the admin

Inline form events

You may want to execute some JavaScript when an inline form is added or removed in the admin change form. The formset:added and formset:removed jQuery events allow this. The event handler is passed three arguments:

  • event is the jQuery event.
  • $row is the newly added (or removed) row.
  • formsetName is the formset the row belongs to.

The event is fired using the django.jQuery namespace.

In your custom change_form.html template, extend the admin_change_form_document_ready