class Event(models.Model):
    name = models.CharField(max_length=20, unique=True)
distance = models.IntegerField()
date = models.DateField()
categories = models.ManyToManyField(Category, through='Result',
    related_name='events')
Django Count of Items in a Field