2025-05-27 15:09:22 +03:30
|
|
|
import typing
|
2025-07-08 11:59:58 +03:30
|
|
|
from apps.authorization.models import UserRelations
|
2025-05-27 15:09:22 +03:30
|
|
|
|
|
|
|
|
|
|
|
|
|
def detect_file_extension(file_name: str) -> typing.AnyStr:
|
|
|
|
|
""" detect extension of a file like: jpg, png, pdf """
|
|
|
|
|
extended = file_name.split('.')
|
|
|
|
|
return extended[1]
|
2025-07-08 11:59:58 +03:30
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_organization_by_user(user: object = None) -> typing.Any:
|
|
|
|
|
organization = UserRelations.objects.select_related('organization').get(user=user).organization
|
|
|
|
|
return organization
|