Adding aggregate over filtered self-join field to Admin list_display
问题 I would like to augment one of my model admins with an interesting value. Given a model like this: class Participant(models.Model): pass class Registration(models.Model): participant = models.ForeignKey(Participant) is_going = models.BooleanField(verbose_name='Is going') Now, I would like to show the number of other Registration s for this Participant where is_going is False . So, something akin to this SQL query: SELECT reg.*, COUNT(past.id) AS not_going_num FROM registrations AS reg,