distribution organizations info - upload document inventory
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import random
|
||||
import string
|
||||
import typing
|
||||
from apps.authorization.models import UserRelations
|
||||
|
||||
@@ -9,5 +11,11 @@ def detect_file_extension(file_name: str) -> typing.AnyStr:
|
||||
|
||||
|
||||
def get_organization_by_user(user: object = None) -> typing.Any:
|
||||
""" get organization object by request user """
|
||||
organization = UserRelations.objects.select_related('organization').get(user=user).organization
|
||||
return organization
|
||||
|
||||
|
||||
def generate_code(length=6):
|
||||
""" generate 6 digit code """
|
||||
return ''.join(random.choices(string.digits, k=length))
|
||||
|
||||
Reference in New Issue
Block a user