Consider the following models:
class Person(models.Model):
name = models.CharField(max_length=128)
class Group(models.Model):
name = models.CharField(max_length=128)
members = models.ManyToManyField(Person, through='Membership')
class Membership(models.Model):
person = models.ForeignKey(Person)
group = models.ForeignKey(Group)
date_joined = models.DateField()
invite_reason = models.CharField(max_length=64)
Membership is a customized many-to-may through object with extra fields.
If I have a person instance, how can I access the corresponding date_joined fields of all its membership relations - both in regular code and in a django template file?