magic-removal: Removed auto_populated_fields and javascript_imports attributes of AdminBoundManipulator
git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2091 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
05c01c71a4
commit
2348f8fcef
|
@ -2,7 +2,7 @@
|
|||
{% load i18n admin_modify adminmedia %}
|
||||
{% block extrahead %}{{ block.super }}
|
||||
<script type="text/javascript" src="../../../jsi18n/"></script>
|
||||
{% for js in bound_manipulator.javascript_imports %}{% include_admin_script js %}{% endfor %}
|
||||
{% for js in javascript_imports %}{% include_admin_script js %}{% endfor %}
|
||||
{% endblock %}
|
||||
{% block coltype %}{% if opts.get_ordered_objects %}colMS{% else %}colM{% endif %}{% endblock %}
|
||||
{% block bodyclass %}{{ opts.app_label }}-{{ opts.object_name.lower }} change-form{% endblock %}
|
||||
|
@ -55,9 +55,9 @@
|
|||
{% if add %}
|
||||
<script type="text/javascript">document.getElementById("{{ bound_manipulator.first_form_field_id }}").focus();</script>
|
||||
{% endif %}
|
||||
{% if bound_manipulator.auto_populated_fields %}
|
||||
{% if auto_populated_fields %}
|
||||
<script type="text/javascript">
|
||||
{% auto_populated_field_script bound_manipulator.auto_populated_fields change %}
|
||||
{% auto_populated_field_script auto_populated_fields change %}
|
||||
</script>
|
||||
{% endif %}
|
||||
{% if change %}
|
||||
|
|
|
@ -148,10 +148,6 @@ class BoundManipulator(object):
|
|||
class AdminBoundManipulator(BoundManipulator):
|
||||
def __init__(self, model, manipulator, field_mapping):
|
||||
super(AdminBoundManipulator, self).__init__(model, manipulator, field_mapping)
|
||||
field_sets = self.opts.admin.get_field_sets(self.opts)
|
||||
|
||||
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.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()]
|
||||
|
||||
|
@ -164,6 +160,8 @@ class AdminBoundManipulator(BoundManipulator):
|
|||
def render_change_form(model, manipulator, context, add=False, change=False, form_url=''):
|
||||
opts = model._meta
|
||||
app_label = opts.app_label
|
||||
auto_populated_fields = [f for f in opts.fields if f.prepopulate_from]
|
||||
field_sets = opts.admin.get_field_sets(opts)
|
||||
extra_context = {
|
||||
'add': add,
|
||||
'change': change,
|
||||
|
@ -171,6 +169,8 @@ def render_change_form(model, manipulator, context, add=False, change=False, for
|
|||
'has_delete_permission': context['perms'][app_label][opts.get_delete_permission()],
|
||||
'has_file_field': opts.has_field_type(models.FileField),
|
||||
'has_absolute_url': hasattr(model, 'get_absolute_url'),
|
||||
'auto_populated_fields': auto_populated_fields,
|
||||
'javascript_imports': get_javascript_imports(opts, auto_populated_fields, field_sets),
|
||||
'form_url': form_url,
|
||||
'opts': opts,
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue