mirror of
https://github.com/django/django.git
synced 2025-08-10 13:58:43 +00:00
Fixed #33335 -- Made model validation ignore functional unique constraints.
Regression in 3aa545281e
.
Thanks Hervé Le Roy for the report.
This commit is contained in:
parent
d3a64bea51
commit
1eaf38fa87
4 changed files with 35 additions and 6 deletions
|
@ -2,6 +2,7 @@ from datetime import datetime
|
|||
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.db import models
|
||||
from django.db.models.functions import Lower
|
||||
|
||||
|
||||
def validate_answer_to_universe(value):
|
||||
|
@ -125,3 +126,13 @@ class GenericIPAddressTestModel(models.Model):
|
|||
|
||||
class GenericIPAddrUnpackUniqueTest(models.Model):
|
||||
generic_v4unpack_ip = models.GenericIPAddressField(null=True, blank=True, unique=True, unpack_ipv4=True)
|
||||
|
||||
|
||||
class UniqueFuncConstraintModel(models.Model):
|
||||
field = models.CharField(max_length=255)
|
||||
|
||||
class Meta:
|
||||
required_db_features = {'supports_expression_indexes'}
|
||||
constraints = [
|
||||
models.UniqueConstraint(Lower('field'), name='func_lower_field_uq'),
|
||||
]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue