9๐
โ
I believe in a case like this, you could make a trivial through
model for your M2M relation, and then use the normal syntax to follow the (now explicit) ForeignKey
s. Something like:
class Address(models.Model):
blah
class MemberData(models.Model):
user = models.ForeignKey(User)
addresses = models.ManyToManyField(Address,through='MemberAddress')
class MemberAddress(models.Model):
member = models.ForeignKey(MemberData)
address = models.ForeignKey(Address)
and in the admin:
class AddressAdmin(admin.ModelAdmin):
model = Address
list_filter = ['memberaddress_set__member__user']
4๐
Iโm using 1.5 and list_filter = ['memberdata__user']
seems like it would work.
๐คAaron McMillin
- Django fixtures DateTimeField runtimeWarning
- How to get user email with python social auth with facebook and save it
Source:stackexchange.com