diff -r 8127b7a73808 src/django/contrib/admin/views/main.py
a
|
b
|
def _get_deleted_objects(deleted_objects
|
419 | 419 | return # Avoid recursing too deep. |
420 | 420 | opts_seen = [] |
421 | 421 | 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: |
423 | 424 | continue |
424 | | opts_seen.append(related.opts) |
425 | | rel_opts_name = related.get_accessor_name() |
| 425 | opts_seen.append(rel_opts_name) |
426 | 426 | if isinstance(related.field.rel, models.OneToOneRel): |
427 | 427 | try: |
428 | 428 | sub_obj = getattr(obj, rel_opts_name) |
… |
… |
def _get_deleted_objects(deleted_objects
|
467 | 467 | if not user.has_perm(p): |
468 | 468 | perms_needed.add(related.opts.verbose_name) |
469 | 469 | 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: |
471 | 472 | continue |
472 | | opts_seen.append(related.opts) |
473 | | rel_opts_name = related.get_accessor_name() |
| 473 | opts_seen.append(rel_opts_name) |
474 | 474 | has_related_objs = False |
475 | 475 | |
476 | 476 | # related.get_accessor_name() could return None for symmetrical relationships |