title: How to generate HASH for Django model
body: <p>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 </p>
  
  <pre><code>return Database.Cursor.execute(self, query, params)
  django.db.utils.IntegrityError: column hash_3 is not unique
  </code></pre>
  
  <p>Here what i have tried :</p>
  
  <pre><code>import os
  import time
  import hashlib
  from os import path
  from binascii import hexlify
  from django.db import models
  from django.contrib import admin
  from django.core.files.storage import FileSystemStorage
  #------------------------------------------------------------------------------ 
  
  def _createHash():
      """This function generate 10 character long hash"""
      hash = hashlib.sha1()
      hash.update(str(time.time()))
      return  hash.hexdigest()[:-10]
  
  
  class tags(models.Model):
      """ This is the tag model """
  
      seo_url1 = models.URLField()
      seo_url2 = models.URLField()
      seo_url3 = models.URLField()
      tagDescription = models.TextField()                 # Tag Description
      tag = models.CharField(max_length=200)              # Tag name
      tagSlug = models.CharField(max_length=400)          # Extra info can be added to the existing tag using this field
      updatedAt = models.DateTimeField(auto_now=True)     # Time at which tag is updated
      createdAt = models.DateTimeField(auto_now_add=True) # Time at which tag is created
      hash_1 = models.CharField(max_length=10,default=_createHash(),unique=True)
      hash_2 = models.CharField(max_length=10,default=_createHash(),unique=True)
      hash_3 = models.CharField(max_length=10,default=_createHash(),unique=True)
  </code></pre>
  
  <p>I have also tried this method:</p>
  
  <pre><code>def _createHash():
      """This function generate 10 character long hash"""
      return hexlify(os.urandom(5))
  </code></pre>
  
  <p>I have a script which inserts data into this model every time i run my script i got above mentioned error ..is there any other way of doing this..i want to store unique hash values into columns <code>hash_1,hash_2,hash_3</code>.</p>