Community mailing list archives

how to set a unique default value for new fields

Pedro Cachaca
- 03/23/2016 19:05:40

I want to add following new field to a model :

token = fields.Char(default=lambda self: '%s' % uuid.uuid4().hex )

But when I update the module, all existing records get the same value uuid for token...

The lambda function is executed one time and result applied to all the records !

How to make the function executed once updating each records ?