django/static_files/import_export/action_formats.js
2020-11-06 21:24:29 +00:00

23 lines
777 B
JavaScript

(function($) {
$(document).on('ready', function() {
var $actionsSelect, $formatsElement;
if ($('body').hasClass('grp-change-list')) {
// using grappelli
$actionsSelect = $('#grp-changelist-form select[name="action"]');
$formatsElement = $('#grp-changelist-form select[name="file_format"]');
} else {
// using default admin
$actionsSelect = $('#changelist-form select[name="action"]');
$formatsElement = $('#changelist-form select[name="file_format"]').parent();
}
$actionsSelect.on('change', function() {
if ($(this).val() === 'export_admin_action') {
$formatsElement.show();
} else {
$formatsElement.hide();
}
});
$actionsSelect.change();
});
})(django.jQuery);