Default nullable fields to null in unique constraints checks

This commit is contained in:
Bruno Alla 2024-10-14 19:06:37 +01:00
parent 2bf6c7df6d
commit 25e01d0761
No known key found for this signature in database

View File

@ -1490,6 +1490,8 @@ class ModelSerializer(Serializer):
default = timezone.now
elif unique_constraint_field.has_default():
default = unique_constraint_field.default
elif unique_constraint_field.null:
default = None
else:
default = empty