I\'m trying to limit the maximum amount of choices a model record can have in a ManyToManyField.
In this example there is a BlogSite that can be related to Regions. In t
The best that I can think of is to have a pre-save signal for BlogSite and check whether this instance of BlogSite has already had 3 regions.
@receiver(pre_save, sender=BlogSite)
def check_regions_limit(sender, instance, **kwargs):
if instance.regions.count() == 3:
raise_some_exception("Can't add more than 3 regions to a BlogSite")