Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
Jacob Kaplan-Moss authored February 26, 2007

Showing 1 changed file with 6 additions and 3 deletions. Show diff stats Hide diff stats

  1. 9  django/contrib/admin/views/main.py
9  django/contrib/admin/views/main.py
@@ -461,9 +461,12 @@ def _get_deleted_objects(deleted_objects, perms_needed, user, obj, opts, current
461 461
         opts_seen.append(related.opts)
462 462
         rel_opts_name = related.get_accessor_name()
463 463
         has_related_objs = False
464  
-        rel_objs = getattr(obj, rel_opts_name, None)
465  
-        if rel_objs:
466  
-            has_related_objs = True
  464
+       
  465
+        # related.get_accessor_name() could return None for symmetrical relationships
  466
+        if rel_opts_name:
  467
+            rel_objs = getattr(obj, rel_opts_name, None)
  468
+            if rel_objs:
  469
+                has_related_objs = True
467 470
 
468 471
         if has_related_objs:
469 472
             for sub_obj in rel_objs.all():

0 notes on commit f3cc581

Please sign in to comment.
Something went wrong with that request. Please try again.