Implementation of kit binding feature for ConfigurableKitProduct variants:
- Added ForeignKey field `kit` to ConfigurableKitProductAttribute
* References ProductKit with CASCADE delete
* Optional field (blank=True, null=True)
* Indexed for efficient queries
- Created migration 0007_add_kit_to_attribute
* Handles existing data (NULL values for all current records)
* Properly indexed for performance
- Updated template configurablekit_form.html
* Injected available ProductKits into JavaScript
* Added kit selector dropdown in card interface
* Each value now has associated kit selection
* JavaScript validates kit selection alongside values
- Updated JavaScript in card interface
* serializeAttributeValues() now collects kit IDs
* Creates parallel JSON arrays: values and kits
* Stores in hidden fields: attributes-X-values and attributes-X-kits
- Updated views _save_attributes_from_cards() in both Create and Update
* Reads kit IDs from POST JSON
* Looks up ProductKit objects
* Creates ConfigurableKitProductAttribute with FK populated
* Gracefully handles missing kits
- Fixed _should_delete_form() method
* More robust handling of formset deletion_field
* Works with all formset types
- Updated __str__() method
* Handles NULL kit case
Example workflow:
Dlina: 50 -> Kit A, 60 -> Kit B, 70 -> Kit C
Upakovka: BEZ -> Kit A, V_UPAKOVKE -> (no kit)
Tested with test_kit_binding.py - all tests passing
- Kit creation and retrieval
- Attribute creation with kit FK
- Mixed kit-bound and unbound attributes
- Querying attributes by kit
- Reverse queries (get kit for attribute value)
Added documentation: KIT_BINDING_IMPLEMENTATION.md
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>