Docs: начальная структура проекта
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
10
app/users/utils.py
Normal file
10
app/users/utils.py
Normal file
@@ -0,0 +1,10 @@
|
||||
"""Хелперы для пользователей."""
|
||||
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
|
||||
Reference in New Issue
Block a user