role fix
This commit is contained in:
@@ -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()
|
||||||
|
|||||||
Reference in New Issue
Block a user