2👍
if you can change the type of folio field to CharField, then you can use uuid
.
import uuid
x = str(uuid.uuid1())
The x
will always be unique and you will never need to check the value for duplicate in the Model.
Hope this helps.
Source:stackexchange.com