From fc31a910466e14e689391d3be57ab048e03be34e Mon Sep 17 00:00:00 2001 From: Patrick Mayr Date: Sat, 30 Jul 2022 11:33:08 +0000 Subject: [PATCH] add create random id function --- fet2020/fet2020/utils.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fet2020/fet2020/utils.py b/fet2020/fet2020/utils.py index e4e87df4..abea0648 100644 --- a/fet2020/fet2020/utils.py +++ b/fet2020/fet2020/utils.py @@ -1,4 +1,6 @@ # util functions for all apps +import uuid + from django.contrib.admin.models import ADDITION, CHANGE, LogEntry from django.contrib.admin.utils import construct_change_message from django.contrib.contenttypes.models import ContentType @@ -22,3 +24,6 @@ def add_log_action(request, form, app_label, model, add=True): action_flag=action_flag, change_message=change_message, ) + +def create_random_id(): + return str(uuid.uuid4())[:8]