magic-removal: Simplified AdminBoundManipulator.form_enc_attrib attribute
git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2087 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
fe70b49661
commit
4e78c1b389
|
@ -20,7 +20,7 @@
|
|||
{% if bound_manipulator.has_absolute_url %}<li><a href="/r/{{ opts.get_content_type_id }}/{{ object_id }}/" class="viewsitelink">{% trans "View on site" %}</a></li>{% endif%}
|
||||
</ul>
|
||||
{% endif %}{% endif %}
|
||||
<form {{ bound_manipulator.form_enc_attrib }} action="{{ form_url }}" method="post">{% block form_top %}{% endblock %}
|
||||
<form {% if has_file_field %}enctype="multipart/form-data" {% endif %}action="{{ form_url }}" method="post">{% block form_top %}{% endblock %}
|
||||
{% if is_popup %}<input type="hidden" name="_popup" value="1">{% endif %}
|
||||
{% if opts.admin.save_on_top %}{% submit_row bound_manipulator %}{% endif %}
|
||||
{% if form.error_dict %}
|
||||
|
|
|
@ -153,7 +153,6 @@ class AdminBoundManipulator(BoundManipulator):
|
|||
self.auto_populated_fields = [f for f in self.opts.fields if f.prepopulate_from]
|
||||
self.javascript_imports = get_javascript_imports(self.opts, self.auto_populated_fields, field_sets);
|
||||
self.has_absolute_url = hasattr(model, 'get_absolute_url')
|
||||
self.form_enc_attrib = self.opts.has_field_type(models.FileField) and 'enctype="multipart/form-data" ' or ''
|
||||
self.first_form_field_id = self.bound_field_sets[0].bound_field_lines[0].bound_fields[0].form_fields[0].get_id();
|
||||
self.ordered_object_pk_names = [o.pk.name for o in self.opts.get_ordered_objects()]
|
||||
|
||||
|
@ -171,6 +170,7 @@ def render_change_form(model, manipulator, context, add=False, change=False, for
|
|||
'change': change,
|
||||
'bound_manipulator': AdminBoundManipulator(model, manipulator, context['form']),
|
||||
'has_delete_permission': context['perms'][app_label][opts.get_delete_permission()],
|
||||
'has_file_field': opts.has_field_type(models.FileField),
|
||||
'form_url': form_url,
|
||||
'opts': opts,
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue