timetracker/games/templatetags/randomid.py

12 lines
231 B
Python
Raw Normal View History

2024-08-11 15:13:31 +00:00
import random
import string
from django import template
register = template.Library()
@register.simple_tag
def randomid(seed: str = "") -> str:
return str(hash(seed + "".join(random.choices(string.ascii_lowercase, k=10))))