I have a model that looks somewhat like this:

```
class Passenger(models.Model):
    name = models.CharField(max_length=50)
    surname = models.CharField(max_length=50)

class Flight(models.Model):
    capacity = models.IntegerField()
    passengers = models.ManyToManyField(Passenger)

```

Before adding a new passenger to the flight I would like to validate whether the number of passengers is not going to exceed the capacity. I was wondering what would be the best way to go about this.

Obviously I could manually check the number of passengers before adding a new one, but maybe there is some support in django? I tried writing a validator, but wasn't sure how to do it.