add create random id function
This commit is contained in:
@@ -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]
|
||||||
|
|||||||
Reference in New Issue
Block a user