1👍
✅
It can’t be done at the model level, but it may be possible to add a constraint at the database level that can enforce this.
1👍
Since Django 1.2 you can use clean() method of the model where you can make such check.
https://docs.djangoproject.com/en/dev/ref/models/instances/?from=olddocs#django.db.models.Model.clean
Source:stackexchange.com