Ticket #3434: patch_admin_for_empty_models.patch

File patch_admin_for_empty_models.patch, 922 bytes (added by marcink@…, 18 years ago)
  • django/contrib/admin/views/main.py

     
    193193    field_sets = opts.admin.get_field_sets(opts)
    194194    original = getattr(manipulator, 'original_object', None)
    195195    bound_field_sets = [field_set.bind(context['form'], original, AdminBoundFieldSet) for field_set in field_sets]
    196     first_form_field_id = bound_field_sets[0].bound_field_lines[0].bound_fields[0].form_fields[0].get_id();
     196    try:
     197        first_form_field_id = bound_field_sets[0].bound_field_lines[0].bound_fields[0].form_fields[0].get_id();
     198    except IndexError:
     199        first_form_field_id = None
    197200    ordered_objects = opts.get_ordered_objects()
    198201    inline_related_objects = opts.get_followed_related_objects(manipulator.follow)
    199202    extra_context = {
Back to Top