Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #2828, a TypeError when deleting objects with m2m relations to …

…self. Thanks, Brian Beck.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@4616 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit f3cc581f3ae591adf0d2dcf201a3d08e5cddef46 1 parent cb1ff2a
@jacobian jacobian authored
Showing with 6 additions and 3 deletions.
  1. +6 −3 django/contrib/admin/views/main.py
View
9 django/contrib/admin/views/main.py
@@ -461,9 +461,12 @@ def _get_deleted_objects(deleted_objects, perms_needed, user, obj, opts, current
opts_seen.append(related.opts)
rel_opts_name = related.get_accessor_name()
has_related_objs = False
- rel_objs = getattr(obj, rel_opts_name, None)
- if rel_objs:
- has_related_objs = True
+
+ # related.get_accessor_name() could return None for symmetrical relationships
+ if rel_opts_name:
+ rel_objs = getattr(obj, rel_opts_name, None)
+ if rel_objs:
+ has_related_objs = True
if has_related_objs:
for sub_obj in rel_objs.all():
Please sign in to comment.
Something went wrong with that request. Please try again.