blob: 7ab79e96a1e340b584ae5dc3b983fdf41355a98a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
<script type="text/javascript">
(function( $ ) {
{% for field in prepopulated_fields %}
$("#{{ field.field.auto_id }}").bind('change.grappelli', function() {
$(this).data('changed', true);
});
{% for dependency in field.dependencies %}
$("#{{ dependency.auto_id }}").bind('keyup.grappelli', function() {
var e = $("#{{ field.field.auto_id }}");
if (!e.data('changed')) {
e.val(URLify({% for innerdep in field.dependencies %}$("#{{ innerdep.auto_id }}").val(){% if not forloop.last %} + ' ' + {% endif %}{% endfor %}, {{ field.field.field.max_length|default_if_none:"50" }}));
}
});
{% endfor %}
{% endfor %}
})(django.jQuery);
</script>
|