﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
2828	TypeError when deleting objects with ManyToMany(self) relationships in the admin	anonymous	Adrian Holovaty	"When trying to delete an object with a ManyToMany(self) relationship you get a ""TypeError getattr(): attribute name must be string"". Have played a little around it and it seems to work correctly when adding ""filter_interface=models.HORIZONTAL"" to the ManyToManyField(self) Field.

Error:
TypeError at /admin/person/person/2/delete/
getattr(): attribute name must be string 

Produces an error:

{{{
class Person(models.Model):
    name = models.CharField(maxlength=20)
    friends = models.ManyToManyField('self',blank=True)
    idols = models.ManyToManyField('self', symmetrical=False,related_name='stalkers',blank=True)

    def __str__(self):
        return self.name

    class Admin:
        pass 
}}}

Works ok:

{{{
class Person(models.Model):
    name = models.CharField(maxlength=20)
    friends = models.ManyToManyField('self',blank=True)
    idols = models.ManyToManyField('self', symmetrical=False,related_name='stalkers',blank=True,filter_interface=models.HORIZONTAL)

    def __str__(self):
        return self.name

    class Admin:
        pass 
}}}"	defect	closed	contrib.admin		normal	fixed			Ready for checkin	1	0	0	0	0	0
