fix: Улучшения системы ценообразования комплектов
Исправлены 4 проблемы: 1. Расчёт цены первого товара - улучшена валидация в getProductPrice и calculateFinalPrice 2. Отображение actual_price в Select2 вместо обычной цены 3. Количество по умолчанию = 1 для новых форм компонентов 4. Auto-select текста при клике на поле количества для удобства редактирования Изменённые файлы: - products/forms.py: добавлен __init__ в KitItemForm для quantity.initial = 1 - products/templates/includes/select2-product-init.html: обновлена formatSelectResult - products/templates/productkit_create.html: добавлен focus handler для auto-select - products/templates/productkit_edit.html: добавлен focus handler для auto-select 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
60
test_approve.py
Normal file
60
test_approve.py
Normal file
@@ -0,0 +1,60 @@
|
||||
import os
|
||||
import sys
|
||||
import django
|
||||
|
||||
# Добавляем путь к проекту
|
||||
sys.path.insert(0, 'C:/Users/team_/Desktop/test_qwen/myproject')
|
||||
|
||||
# Настройка Django
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproject.settings')
|
||||
django.setup()
|
||||
|
||||
from tenants.models import TenantRegistration, Client
|
||||
from django.contrib.auth import get_user_model
|
||||
from tenants.admin import TenantRegistrationAdmin
|
||||
|
||||
# Получаем заявку
|
||||
registration = TenantRegistration.objects.get(schema_name='shop3')
|
||||
|
||||
print(f"Before approval:")
|
||||
print(f" Status: {registration.status}")
|
||||
print(f" Tenant: {registration.tenant}")
|
||||
|
||||
# Одобряем заявку
|
||||
admin = TenantRegistrationAdmin(TenantRegistration, None)
|
||||
User = get_user_model()
|
||||
|
||||
# Получаем или создаём системного пользователя для логирования
|
||||
try:
|
||||
admin_user = User.objects.get(email='admin@localhost')
|
||||
except User.DoesNotExist:
|
||||
admin_user = User.objects.create_superuser(
|
||||
email='admin@localhost',
|
||||
name='Admin',
|
||||
password='admin'
|
||||
)
|
||||
|
||||
try:
|
||||
admin._approve_registration(registration, admin_user)
|
||||
print("\nApproval successful!")
|
||||
|
||||
# Проверяем результат
|
||||
registration.refresh_from_db()
|
||||
print(f"\nAfter approval:")
|
||||
print(f" Status: {registration.status}")
|
||||
print(f" Tenant: {registration.tenant}")
|
||||
|
||||
# Проверяем, существует ли тенант в БД
|
||||
if registration.tenant:
|
||||
client = Client.objects.get(pk=registration.tenant.pk)
|
||||
print(f" Client created: {client.name} ({client.schema_name})")
|
||||
|
||||
# Проверяем домены
|
||||
from tenants.models import Domain
|
||||
domains = Domain.objects.filter(tenant=client)
|
||||
print(f" Domains: {list(domains.values_list('domain', flat=True))}")
|
||||
|
||||
except Exception as e:
|
||||
print(f"Approval failed: {str(e)}")
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
Reference in New Issue
Block a user