Skip to content

Instantly share code, notes, and snippets.

View piotrkilczuk's full-sized avatar
🐈
I may be slow to respond.

Piotr Kilczuk piotrkilczuk

🐈
I may be slow to respond.
  • Rzeszów, PL
  • 00:05 (UTC -12:00)
View GitHub Profile
from django.db import models
import uuid
class UUIDField(models.CharField):
"""
A field which stores a UUID value in hex format. This may also have
the Boolean attribute 'auto' which will set the value on initial save to a
new UUID value (calculated using the UUID1 method). Note that while all
UUIDs are expected to be unique we enforce this with a DB constraint.