diff options
Diffstat (limited to 'static/admin/js/prepopulate.js')
l---------[-rw-r--r--] | static/admin/js/prepopulate.js | 43 |
1 files changed, 1 insertions, 42 deletions
diff --git a/static/admin/js/prepopulate.js b/static/admin/js/prepopulate.js index bef45a3..408d03b 100644..120000 --- a/static/admin/js/prepopulate.js +++ b/static/admin/js/prepopulate.js @@ -1,42 +1 @@ -/*global URLify*/ -(function($) { - 'use strict'; - $.fn.prepopulate = function(dependencies, maxLength, allowUnicode) { - /* - Depends on urlify.js - Populates a selected field with the values of the dependent fields, - URLifies and shortens the string. - dependencies - array of dependent fields ids - maxLength - maximum length of the URLify'd string - allowUnicode - Unicode support of the URLify'd string - */ - return this.each(function() { - var prepopulatedField = $(this); - - var populate = function() { - // Bail if the field's value has been changed by the user - if (prepopulatedField.data('_changed')) { - return; - } - - var values = []; - $.each(dependencies, function(i, field) { - field = $(field); - if (field.val().length > 0) { - values.push(field.val()); - } - }); - prepopulatedField.val(URLify(values.join(' '), maxLength, allowUnicode)); - }; - - prepopulatedField.data('_changed', false); - prepopulatedField.on('change', function() { - prepopulatedField.data('_changed', true); - }); - - if (!prepopulatedField.val()) { - $(dependencies.join(',')).on('keyup change focus', populate); - } - }); - }; -})(django.jQuery); +/home/prashant/www/html/python/python_3.x/django_3.x/os-hardware/env-osh/lib/python3.6/site-packages/django/contrib/admin/static/admin/js/prepopulate.js
\ No newline at end of file |