2025-07-26
This commit is contained in:
11
boxofficefantasy_project/utils.py
Normal file
11
boxofficefantasy_project/utils.py
Normal file
@@ -0,0 +1,11 @@
|
||||
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
|
||||
Reference in New Issue
Block a user