This commit is contained in:
IluaAir
2025-09-30 18:41:22 +03:00
parent d75d98d1a2
commit 1d825546cb

View File

@@ -205,7 +205,7 @@ class CreateTenant(Script):
except Exception as e: except Exception as e:
self.log_failure(f"Ошибка при создании контакта: {e}") self.log_failure(f"Ошибка при создании контакта: {e}")
try: try:
role = data.get("contacts_role", ContactRole.objects.first()) role = data.get("contacts_role") or ContactRole.objects.first()
assignment = ContactAssignment( assignment = ContactAssignment(
contact=contact, contact=contact,
role=role, role=role,
@@ -242,9 +242,10 @@ class CreateTenant(Script):
email=data["contacts_email"], email=data["contacts_email"],
) )
contact.full_clean() contact.full_clean()
role = data.get("contacts_role") or ContactRole.objects.first()
assignment = ContactAssignment( assignment = ContactAssignment(
contact=contact, contact=contact,
role=data.get("contacts_role", ContactRole.objects.first()), role=role,
object=tenant, object=tenant,
) )
assignment.full_clean() assignment.full_clean()