Skip to content

amcat/django-hash-field

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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"

About

Hash field for django stored in postgres as uuid

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages