Django Specifying the maximum size of an ArrayField


Example

 from django.db import models, IntegerField
 from django.contrib.postgres.fields import ArrayField
 
 class IceCream(models.Model):
     scoops = ArrayField(IntegerField()  # we'll use numbers to ID the scoops
                   , size=6)  # our parlor only lets you have 6 scoops

When you use the size parameter, it's passed through to postgresql, which accepts it and then ignores it! Thus it's quite possible to add 7 integers to the scoops field above using the postgresql console.