mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +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:
committed by
Mariusz Felisiak
parent
d3a64bea51
commit
1eaf38fa87
@@ -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'),
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user