KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a simple Django model resembling: class Address(models.Model): blah class MemberData(models.Model): user = models.ForeignKey(User) addresses = models.ManyToManyField(Address) I want to expose the Address model in admin to allow a user to filter Address records by their associated user. e.g. class AddressAdmin(admin.ModelAdmin): model = Address list_filter = [???] The ModelAdmin.list_filter property allows this, but I'm not sure what field name to use to support my many-to-many relationship. If the Address model has a direct reference to the MemberData model, I could do something like: class AddressAdmin(admin.ModelAdmin): model = Address list_filter = ['memberdata__user'] Is there any equivalent syntax for an indirect many-to-many relationship? If not, is there any workaround to accomplish the same end?
Tags (comma-separated)
Save Edits
Cancel