PageRenderTime 428ms CodeModel.GetById 152ms app.highlight 11ms RepoModel.GetById 261ms app.codeStats 0ms

/django/contrib/admin/templates/admin/prepopulated_fields_js.html

https://code.google.com/p/mango-py/
HTML | 23 lines | 20 code | 3 blank | 0 comment | 0 complexity | 1b98dca784b44239705eb4e4a5e8682f MD5 | raw file
 1<script type="text/javascript">
 2(function($) {
 3    var field = null;
 4
 5{% for field in prepopulated_fields %}
 6    field = {
 7        id: '#{{ field.field.auto_id }}',
 8        dependency_ids: [],
 9        dependency_list: [],
10        maxLength: {{ field.field.field.max_length|default_if_none:"50" }}
11    };
12
13    {% for dependency in field.dependencies %}
14    field['dependency_ids'].push('#{{ dependency.auto_id }}');
15    field['dependency_list'].push('.{{ dependency.name }}');
16    {% endfor %}
17
18    $('.empty-form .{{ field.field.name }}').addClass('prepopulated_field');
19    $(field.id).data('dependency_list', field['dependency_list'])
20               .prepopulate(field['dependency_ids'], field.maxLength);
21{% endfor %}
22})(django.jQuery);
23</script>