django-hash-field

Hash field for Django (stored in postgres as UUID)


Keywords
django
License
Other
Install
pip install django-hash-field==0.01

Documentation

Django hash field

Hash field for django stored in binary but converted to/from hex notation.

Installation

pip install django-hash-field

Usage

See the test project. Declare a hash field on your model:

class HashTest(models.Model):
    hash_field = HashField()

Populate field with hex notation:

hash = hashlib.sha1(b"12345").hexdigest()
h = HashTest.objects.create(hash_field=hash)

Although the field is stored in a binary db field, you can read/write it in hex notation:

assert h.hash == "8cb2237d0679ca88db6464eac60da96345513964"