PageRenderTime 35ms CodeModel.GetById 12ms RepoModel.GetById 0ms 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
Possible License(s): BSD-3-Clause
  1. <script type="text/javascript">
  2. (function($) {
  3. var field = null;
  4. {% for field in prepopulated_fields %}
  5. field = {
  6. id: '#{{ field.field.auto_id }}',
  7. dependency_ids: [],
  8. dependency_list: [],
  9. maxLength: {{ field.field.field.max_length|default_if_none:"50" }}
  10. };
  11. {% for dependency in field.dependencies %}
  12. field['dependency_ids'].push('#{{ dependency.auto_id }}');
  13. field['dependency_list'].push('.{{ dependency.name }}');
  14. {% endfor %}
  15. $('.empty-form .{{ field.field.name }}').addClass('prepopulated_field');
  16. $(field.id).data('dependency_list', field['dependency_list'])
  17. .prepopulate(field['dependency_ids'], field.maxLength);
  18. {% endfor %}
  19. })(django.jQuery);
  20. </script>