code: def hash_model_values(model, clear=True, hash_field='values_hash', hash_fun=hash, ignore_pk=True, ignore_fields=[]):
      
      qs = getattr(model, 'objects', model)
      model = qs.model
      if ignore_pk:
          ignore_fields += [model._meta.pk.name]
      if not hasattr(model, hash_field):
          warnings.warn("%r doesn't have a field named %s in which to store a hash value. Skipping." % (model, hash_field))
          return
      for obj in qs:
          # ignore primary key (id field) when hashing values
          h = hash_fun(tuple([getattr(obj, k) for k in obj._meta.get_all_field_names() if k not in ignore_fields]))
          tracking_obj, created = ChangeLog.get_or_create(app=model._meta.app_label, model=model._meta.object_name, primary_key=obj.pk)
          tracking_obj.update(hash_value=h)
docs: Hash values of DB table records to facilitate tracking changes to the DB table
  
      Intended for comparing records in one table to those in another (with potentially differing id/pk values)
      For example, changes to a table in a read-only MS SQL database can be quickly identified
      and mirrored to a writeable PostGRE DB where these hash values are stored along side the data.