Files
2025-07-26 14:52:54 -05:00

11 lines
280 B
Python

from hashids import Hashids
from django.conf import settings
hashids = Hashids(min_length=8, salt=settings.HASHIDS_SALT)
def encode_id(id):
return hashids.encode(id)
def decode_id(hashid):
decoded = hashids.decode(hashid)
return int(decoded[0]) if decoded else None