mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #19463 -- Added UUIDField
Uses native support in postgres, and char(32) on other backends.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import os
|
||||
import tempfile
|
||||
import uuid
|
||||
import warnings
|
||||
|
||||
try:
|
||||
@@ -294,3 +295,15 @@ if Image:
|
||||
width_field='headshot_width')
|
||||
|
||||
###############################################################################
|
||||
|
||||
|
||||
class UUIDModel(models.Model):
|
||||
field = models.UUIDField()
|
||||
|
||||
|
||||
class NullableUUIDModel(models.Model):
|
||||
field = models.UUIDField(blank=True, null=True)
|
||||
|
||||
|
||||
class PrimaryKeyUUIDModel(models.Model):
|
||||
id = models.UUIDField(primary_key=True, default=uuid.uuid4)
|
||||
|
||||
Reference in New Issue
Block a user