Django model field default from model method
I ended up doing this: (removing the self from both)
Class Person(models.Model): def create_id(): return os.urandom(12).encode('hex') name = models.CharField(max_length = 255) id = models.CharField(max_length = 255,default = create_id)
it is working, but i am not sure if this is the best or the right way.