PROJECTS NOTES HOME

Move django-admin inline with a little bit of javascript

Since I did not find a way to move the inlines with the help of django templates, since by default inlines are always placed at the bottom of the page, I had to use some javascript for this.

Below is from shipping project:

const manual_ship_type_field = document.querySelector('div.field-manual_ship_type');
const whole_manual_mapping_block = manual_ship_type_field.parentElement.parentElement;
const forecasted_values_block = document.getElementById('vessel_vessel_forecasted_value-group');
whole_manual_mapping_block.insertAdjacentElement('afterend', forecasted_values_block);