add create random id function

This commit is contained in:
2022-07-30 11:33:08 +00:00
parent a8ecdb2de9
commit fc31a91046

View File

@@ -1,4 +1,6 @@
# util functions for all apps # util functions for all apps
import uuid
from django.contrib.admin.models import ADDITION, CHANGE, LogEntry from django.contrib.admin.models import ADDITION, CHANGE, LogEntry
from django.contrib.admin.utils import construct_change_message from django.contrib.admin.utils import construct_change_message
from django.contrib.contenttypes.models import ContentType 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, action_flag=action_flag,
change_message=change_message, change_message=change_message,
) )
def create_random_id():
return str(uuid.uuid4())[:8]