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