In Django what model field is best use to store an orderable UUID that comprises of...
[32-bit timestamp high]-[16-bit timestamp mid]-[16-bit timestamp low]-[16 bits random]-[48 bits random]
At the moment I'm using a CharField below is there something better fitted?
id = models.CharField(primary_key=True, max_length=28, unique=True,default=make_key)
Django 1.8 introduced UUIDField. It uses UUID class from standard python library in which data is stored in different byte order from what you've presented, but as far as I know python UUID class can present UUID in various formats.
Prior to Django 1.8 you can use some third party package for that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With