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:
61
test_fresh_tenant.py
Normal file
61
test_fresh_tenant.py
Normal file
@@ -0,0 +1,61 @@
|
||||
import os
|
||||
import sys
|
||||
import django
|
||||
import uuid
|
||||
|
||||
sys.path.insert(0, 'C:/Users/team_/Desktop/test_qwen/myproject')
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproject.settings')
|
||||
django.setup()
|
||||
|
||||
# Проверяем, какой пароль в settings
|
||||
from django.conf import settings
|
||||
print(f"Settings TENANT_ADMIN_PASSWORD: {settings.TENANT_ADMIN_PASSWORD}")
|
||||
print(f"Settings TENANT_ADMIN_EMAIL: {settings.TENANT_ADMIN_EMAIL}\n")
|
||||
|
||||
from tenants.models import TenantRegistration, Client, Domain
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.db import connection
|
||||
from tenants.admin import TenantRegistrationAdmin
|
||||
|
||||
# Создаём новую заявку
|
||||
unique_id = str(uuid.uuid4())[:8]
|
||||
schema_name = f'test_{unique_id}'
|
||||
|
||||
registration = TenantRegistration.objects.create(
|
||||
shop_name=f'Fresh Test {unique_id}',
|
||||
schema_name=schema_name,
|
||||
owner_email='fresh@example.com',
|
||||
owner_name='Fresh User',
|
||||
phone='+375291234567',
|
||||
status=TenantRegistration.STATUS_PENDING
|
||||
)
|
||||
|
||||
print(f"Created registration for: {schema_name}\n")
|
||||
|
||||
# Переключаемся в public
|
||||
public_tenant = Client.objects.get(schema_name='public')
|
||||
connection.set_tenant(public_tenant)
|
||||
|
||||
User = get_user_model()
|
||||
admin_user = User.objects.first()
|
||||
|
||||
# Одобряем заявку
|
||||
admin = TenantRegistrationAdmin(TenantRegistration, None)
|
||||
admin._approve_registration(registration, admin_user)
|
||||
|
||||
# Переключаемся в новый тенант
|
||||
registration.refresh_from_db()
|
||||
tenant = registration.tenant
|
||||
connection.set_tenant(tenant)
|
||||
|
||||
# Проверяем пароль
|
||||
admin_in_tenant = User.objects.get(email='admin@localhost')
|
||||
print(f"Checking password for admin@localhost in {schema_name}:")
|
||||
print(f" Password 'AdminPassword123': {admin_in_tenant.check_password('AdminPassword123')}")
|
||||
|
||||
if admin_in_tenant.check_password('AdminPassword123'):
|
||||
print(f"\nSUCCESS! You can login with:")
|
||||
print(f" Email: admin@localhost")
|
||||
print(f" Password: AdminPassword123")
|
||||
else:
|
||||
print(f"\nFAILED! Password doesn't work")
|
||||
Reference in New Issue
Block a user