11 lines
447 B
Python
11 lines
447 B
Python
"""Хелперы для пользователей."""
|
|
def get_author_employee(user):
|
|
"""Возвращает сотрудника (автора) для текущего пользователя, если привязан профиль."""
|
|
if not user or not user.is_authenticated:
|
|
return None
|
|
try:
|
|
profile = user.profile
|
|
return profile.employee if profile else None
|
|
except Exception:
|
|
return None
|