From 67341b294f8dec6112a3872ec5c50bcd13c9ba78 Mon Sep 17 00:00:00 2001 From: Andrey Smakotin Date: Tue, 18 Nov 2025 21:47:12 +0300 Subject: [PATCH] Remove temporary test scripts from git --- check_kit_bindings.py | 44 --------------------------------- myproject/check_kit_bindings.py | 27 -------------------- 2 files changed, 71 deletions(-) delete mode 100644 check_kit_bindings.py delete mode 100644 myproject/check_kit_bindings.py diff --git a/check_kit_bindings.py b/check_kit_bindings.py deleted file mode 100644 index 713aded..0000000 --- a/check_kit_bindings.py +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env python -""" -Check existing kit bindings in database -""" -import os -import sys -import django - -os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproject.settings') -django.setup() - -from products.models.kits import ConfigurableKitProduct, ConfigurableKitProductAttribute -from django_tenants.utils import tenant_context -from tenants.models import Client - -try: - client = Client.objects.get(schema_name='grach') -except Client.DoesNotExist: - print("Tenant 'grach' not found") - sys.exit(1) - -with tenant_context(client): - print("=" * 80) - print("Current ConfigurableKitProduct items in database:") - print("=" * 80) - - for product in ConfigurableKitProduct.objects.all().order_by('-id')[:5]: - attrs_count = product.parent_attributes.count() - kit_bound = product.parent_attributes.filter(kit__isnull=False).count() - - print(f"\nID {product.id}: {product.name} (SKU: {product.sku})") - print(f" Total attributes: {attrs_count}") - print(f" Kit-bound attributes: {kit_bound}") - - if attrs_count > 0: - print(" Attribute breakdown:") - params = product.parent_attributes.values('name').distinct() - for param in params: - param_name = param['name'] - values = product.parent_attributes.filter(name=param_name).values_list('option', 'kit__name') - print(f" - {param_name}:") - for value, kit_name in values: - kit_info = f"Kit: {kit_name}" if kit_name else "(no kit)" - print(f" * {value} -> {kit_info}") diff --git a/myproject/check_kit_bindings.py b/myproject/check_kit_bindings.py deleted file mode 100644 index d4b65cf..0000000 --- a/myproject/check_kit_bindings.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env python -import os, sys, django -os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproject.settings') -django.setup() - -from products.models.kits import ConfigurableKitProduct -from django_tenants.utils import tenant_context -from tenants.models import Client - -client = Client.objects.get(schema_name='grach') -with tenant_context(client): - print("=" * 80) - print("ConfigurableKitProduct items with kit bindings:") - print("=" * 80) - - for product in ConfigurableKitProduct.objects.all().order_by('-id')[:5]: - attrs = product.parent_attributes.all() - if attrs.exists(): - kit_bound = attrs.filter(kit__isnull=False).count() - print(f"\nID {product.id}: {product.name}") - print(f" Total attrs: {attrs.count()} | Kit-bound: {kit_bound}") - for param_name in attrs.values_list('name', flat=True).distinct(): - vals = attrs.filter(name=param_name) - print(f" {param_name}:") - for attr in vals: - kit = attr.kit.name if attr.kit else "(no kit)" - print(f" - {attr.option} -> {kit}")