Django: name of many to many items in the admin interface

Posted by Adam on Stack Overflow See other posts from Stack Overflow or by Adam
Published on 2014-08-21T16:13:26Z Indexed on 2014/08/21 16:20 UTC
Read the original article Hit count: 421

I have a many to many field, which I'm displaying in the django admin panel. When I add multiple items, they all come up as "ASGGroup object" in the display selector. Instead, I want them to come up as whatever the ASGGroup.name field is set to. How do I do this?

My models looks like:

class Thing(Model):
    read_groups = ManyToManyField('ASGGroup', related_name="thing_read", blank=True)

class ASGGroup(Model):
    name = CharField(max_length=63, null=True)

But what I'm seeing the m2m widget display is:

m2m display

© Stack Overflow or respective owner

Related posts about python

Related posts about django