summaryrefslogtreecommitdiff
path: root/src/static/admin/js/change_form.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/static/admin/js/change_form.js')
-rw-r--r--src/static/admin/js/change_form.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/static/admin/js/change_form.js b/src/static/admin/js/change_form.js
new file mode 100644
index 0000000..4797383
--- /dev/null
+++ b/src/static/admin/js/change_form.js
@@ -0,0 +1,20 @@
+/*global showAddAnotherPopup, showRelatedObjectLookupPopup showRelatedObjectPopup updateRelatedObjectLinks*/
+
+(function($) {
+ 'use strict';
+ $(document).ready(function() {
+ var modelName = $('#django-admin-form-add-constants').data('modelName');
+ $('body').on('click', '.add-another', function(e) {
+ e.preventDefault();
+ var event = $.Event('django:add-another-related');
+ $(this).trigger(event);
+ if (!event.isDefaultPrevented()) {
+ showAddAnotherPopup(this);
+ }
+ });
+
+ if (modelName) {
+ $('form#' + modelName + '_form :input:visible:enabled:first').focus();
+ }
+ });
+})(django.jQuery);