I am adding a field to a database:
identifier = models.UUIDField(unique=True, null=True, blank=True)
but I am curious if this will behave like a CharField or a number field when someone saves an instance in the admin without a value. Will it try to save the value as an empty string ""
or will it be smart and save it as null
? I am using Postgres for the database. I've seen other answers for CharField, but nothing that speaks to UUIDField.
My end goal is to have a field that is guaranteed to be unique, and will default to null
. would it be more appropriate to write it as:
identifier = models.UUIDField(unique=True, null=True, default=None)
or will the admin form validation complain if no value is provided?