From 4404bebba77c5f09026887c3f878e4c11411c7e1 Mon Sep 17 00:00:00 2001 From: Andrey Smakotin Date: Mon, 1 Dec 2025 22:20:14 +0300 Subject: [PATCH] fix: add missing RoleService import and improve admin buttons layout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fixed UnboundLocalError by importing RoleService before use - Changed action buttons to vertical stack layout to prevent overlap - Buttons now use flexbox column layout with proper spacing 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- myproject/tenants/admin.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/myproject/tenants/admin.py b/myproject/tenants/admin.py index 81d6e18..9c6234f 100644 --- a/myproject/tenants/admin.py +++ b/myproject/tenants/admin.py @@ -144,8 +144,10 @@ class TenantRegistrationAdmin(admin.ModelAdmin): if obj.status == TenantRegistration.STATUS_PENDING: approve_url = reverse('admin:tenants_tenantregistration_change', args=[obj.pk]) return format_html( - 'Активировать ' - 'Отклонить', + '
' + 'Активировать' + 'Отклонить' + '
', approve_url, approve_url ) elif obj.status == TenantRegistration.STATUS_APPROVED: @@ -350,6 +352,7 @@ class TenantRegistrationAdmin(admin.ModelAdmin): # Назначаем роль owner владельцу try: from user_roles.models import Role + from user_roles.services import RoleService RoleService.assign_role_to_user(owner, Role.OWNER, created_by=None) logger.info(f"Роль owner назначена владельцу {owner.email}") except Exception as e: