UUID as default value in Django model

后端 未结 2 1777
小鲜肉
小鲜肉 2021-02-07 07:00

I\'ve noticed the strange behaviour of default value in django model. For example we have a simple django model:

import uuid
...

class SiteUser(models.Model):
          


        
2条回答
  •  日久生厌
    2021-02-07 07:27

    As of Django 1.8, there is a new UUIDField available. It's described in the following link which also covers how to set defaults:

    https://docs.djangoproject.com/en/1.8/ref/models/fields/#uuidfield

提交回复
热议问题