Ticket #8357: 8357.diff

File 8357.diff, 1.3 KB (added by evan_schulz, 16 years ago)

correction to original diff

  • django/contrib/admin/templatetags/admin_modify.py

     
    88    the prepopulated fields for both the admin form and inlines.
    99    """
    1010    prepopulated_fields = []
    11     if context["add"]:
     11    if context["add"] and getattr(context, 'adminform', False):
    1212        prepopulated_fields.extend(context["adminform"].prepopulated_fields)
    13     for inline_admin_formset in context['inline_admin_formsets']:
    14         for inline_admin_form in inline_admin_formset:
    15             if inline_admin_form.original is None:
    16                 prepopulated_fields.extend(inline_admin_form.prepopulated_fields)
     13    if getattr(context, 'inline_admin_formsets', False):
     14        for inline_admin_formset in context['inline_admin_formsets']:
     15            for inline_admin_form in inline_admin_formset:
     16                if inline_admin_form.original is None:
     17                    prepopulated_fields.extend(inline_admin_form.prepopulated_fields)
    1718    context.update({"prepopulated_fields": prepopulated_fields})
    1819    return context
    1920prepopulated_fields_js = register.inclusion_tag('admin/prepopulated_fields_js.html', takes_context=True)(prepopulated_fields_js)
Back to Top