I am trying to generate unique HASH values for my Django models of 10 digit i have tried these methods but i am getting this error
return Database.Cursor.ex
Don't call the _createHash()
function in your field, but just pass the reference to the callable in your model, e.g.
hash_1 = models.CharField(max_length=10,default=_createHash,unique=True)
As Lennart Regebro mentioned in his answer, you'll get the same value for each time you start the server in your attempt.
The Django docs say this about it:
Field.default
The default value for the field. This can be a value or a callable object. If callable it will be called every time a new object is created.