Files
social-graph/backend/contacts/bootstrap.py
T
gitrusprusandCursor 4eb4c145b6 Add JWT auth with per-user data isolation and account settings.
Users can register, log in, and manage profile/password in a personal account page; server data is scoped by owner across contacts, maps, tags, and import.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-28 21:10:16 +03:00

30 lines
1012 B
Python

DEFAULT_SECTORS = [
{'key': 'work', 'label': 'Работа'},
{'key': 'study', 'label': 'Учёба'},
{'key': 'hobby', 'label': 'Хобби'},
{'key': 'family', 'label': 'Семья'},
{'key': 'health', 'label': 'Здоровье'},
{'key': 'other', 'label': 'Другое'},
]
DEFAULT_CIRCLES = [
{'key': 'support', 'label': 'Круг поддержки'},
{'key': 'productivity', 'label': 'Круг продуктивности'},
{'key': 'development', 'label': 'Круг развития'},
]
def ensure_user_defaults(user):
"""Создаёт тип карты по умолчанию для нового пользователя."""
from contacts.models import NetworkMapType
if NetworkMapType.objects.filter(owner=user, is_default=True).exists():
return
NetworkMapType.objects.create(
owner=user,
is_default=True,
name='Стандартная',
sectors=DEFAULT_SECTORS,
circles=DEFAULT_CIRCLES,
)