Ticket #1196: atterror.diff

File atterror.diff, 1.8 KB (added by oggie rob, 19 years ago)

Patch for _get_deleted_objects method

  • django/contrib/admin/views/main.py

     
    592592                else:
    593593                    # Display a link to the admin page.
    594594                    nh(deleted_objects, current_depth, ['%s: <a href="../../../../%s/%s/%s/">%s</a>' % \
    595                         (capfirst(related.opts.verbose_name), related.opts.app_label, related.opts.module_name, sub_obj.id, strip_tags(str(sub_obj))), []])
     595                        (capfirst(related.opts.verbose_name), related.opts.app_label, related.opts.module_name, getattr(sub_obj, '%s' % sub_obj._meta.pk.attname), strip_tags(str(sub_obj))), []])
    596596                _get_deleted_objects(deleted_objects, perms_needed, user, sub_obj, related.opts, current_depth+2)
    597597            # If there were related objects, and the user doesn't have
    598598            # permission to delete them, add the missing perm to perms_needed.
     
    618618                nh(deleted_objects, current_depth, [
    619619                    (_('One or more %(fieldname)s in %(name)s:') % {'fieldname': related.field.name, 'name':related.opts.verbose_name}) + \
    620620                    (' <a href="../../../../%s/%s/%s/">%s</a>' % \
    621                         (related.opts.app_label, related.opts.module_name, sub_obj.id, strip_tags(str(sub_obj)))), []])
     621                        (related.opts.app_label, related.opts.module_name, getattr(sub_obj, '%s' % sub_obj._meta.pk.attname), strip_tags(str(sub_obj)))), []])
    622622        # If there were related objects, and the user doesn't have
    623623        # permission to change them, add the missing perm to perms_needed.
    624624        if related.opts.admin and has_related_objs:
Back to Top