Hello site
[auf_framonde.git] / eggs / Django-1.4.5-py2.7.egg / django / contrib / admin / templates / admin / prepopulated_fields_js.html
CommitLineData
01b54c21
MN
1{% load l10n %}
2<script type="text/javascript">
3(function($) {
4 var field;
5
6{% for field in prepopulated_fields %}
7 field = {
8 id: '#{{ field.field.auto_id }}',
9 dependency_ids: [],
10 dependency_list: [],
11 maxLength: {{ field.field.field.max_length|default_if_none:"50"|unlocalize }}
12 };
13
14 {% for dependency in field.dependencies %}
15 field['dependency_ids'].push('#{{ dependency.auto_id }}');
16 field['dependency_list'].push('{{ dependency.name }}');
17 {% endfor %}
18
19 {% comment %}
20 Mark prepopulated fields in the main form and stacked inlines (.empty-form .form-row) and in tabular inlines (.empty-form.form-row)
21 {% endcomment %}
22 $('.empty-form .form-row .field-{{ field.field.name }}, .empty-form.form-row .field-{{ field.field.name }}').addClass('prepopulated_field');
23 $(field.id).data('dependency_list', field['dependency_list'])
24 .prepopulate(field['dependency_ids'], field.maxLength);
25{% endfor %}
26})(django.jQuery);
27</script>