Ticket #6191: _get_deleted_objects.patch

File _get_deleted_objects.patch, 1.4 KB (added by nicklane, 17 years ago)

6191.patch

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

    diff -r 8127b7a73808 src/django/contrib/admin/views/main.py
    a b def _get_deleted_objects(deleted_objects  
    419419        return # Avoid recursing too deep.
    420420    opts_seen = []
    421421    for related in opts.get_all_related_objects():
    422         if related.opts in opts_seen:
     422        rel_opts_name = related.get_accessor_name()
     423        if rel_opts_name in opts_seen:
    423424            continue
    424         opts_seen.append(related.opts)
    425         rel_opts_name = related.get_accessor_name()
     425        opts_seen.append(rel_opts_name)
    426426        if isinstance(related.field.rel, models.OneToOneRel):
    427427            try:
    428428                sub_obj = getattr(obj, rel_opts_name)
    def _get_deleted_objects(deleted_objects  
    467467                if not user.has_perm(p):
    468468                    perms_needed.add(related.opts.verbose_name)
    469469    for related in opts.get_all_related_many_to_many_objects():
    470         if related.opts in opts_seen:
     470        rel_opts_name = related.get_accessor_name()
     471        if rel_opts_name in opts_seen:
    471472            continue
    472         opts_seen.append(related.opts)
    473         rel_opts_name = related.get_accessor_name()
     473        opts_seen.append(rel_opts_name)
    474474        has_related_objs = False
    475475
    476476        # related.get_accessor_name() could return None for symmetrical relationships
Back to Top