1👍
✅
Since django-4.0, you can work with expressions in a UniqueConstraint
[Django-doc], so:
class Tag(models.Model):
name = models.CharField(max_length=30)
class Meta:
constraints = [
models.UniqueConstraint(
Lower('name'),
name='unique_name'
)
]
Source:stackexchange.com