#23617: The new UUID field does not allow to automatically generate a UUID on
save
-------------------------------------+-------------------------------------
Reporter: thedrow | Owner: zedr
Type: New feature | Status: assigned
Component: Database layer | Version: master
(models, ORM) | Resolution:
Severity: Normal | Triage Stage:
Keywords: | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by zedr):
I could not replicate the issue.
I followed the example provided in the Django Developer Docs:
{{{
class MyUUIDModel(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4,
editable=False)
}}}
and it works as intended. Instances of the MyUUIDModel will have a valid
and unique UUID4 identifier created by default, if one is not provided.
I did not find an existing test for this feature. To investigate this, I
created a new test for the UUIDField default keyword, and submitted it as
https://github.com/django/django/pull/3351
--
Ticket URL: <https://code.djangoproject.com/ticket/23617#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/065.2a7702564d14110bb1ab769e6a6b9144%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.