mirror of
				https://github.com/django/django.git
				synced 2025-10-28 08:06:09 +00:00 
			
		
		
		
	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
This commit is contained in:
		| @@ -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(): | ||||
|   | ||||
		Reference in New Issue
	
	Block a user