feat: Complete Company Migration Project and Fix Autocomplete Issues

- Implemented a comprehensive migration from a single Company model to specialized entities (Operators, PropertyOwners, Manufacturers, Designers).
- Resolved critical issues in search suggestions that were returning 404 errors by fixing database queries and reordering URL patterns.
- Conducted extensive testing and validation of the new entity relationships, ensuring all core functionality is operational.
- Updated test suite to reflect changes in entity structure, including renaming fields from `owner` to `operator`.
- Addressed display issues in the user interface related to operator and manufacturer information.
- Completed migration cleanup, fixing references to the removed `companies` app across migration files and test configurations.
- Established a stable testing environment with successful test database creation and functional test infrastructure.
This commit is contained in:
pacnpal
2025-07-05 22:00:21 -04:00
parent b871a1d396
commit 7815de158e
24 changed files with 2305 additions and 97 deletions

View File

@@ -55,7 +55,7 @@ class ParkFilterTests(TestCase):
name="Family Fun Park",
description="Family-friendly entertainment and attractions",
status="CLOSED_TEMP",
owner=cls.operator2,
operator=cls.operator2,
opening_date=date(2015, 6, 15),
size_acres=50,
ride_count=15,
@@ -190,25 +190,25 @@ class ParkFilterTests(TestCase):
f"Filter should be invalid for data: {invalid_data}"
)
def test_company_filtering(self):
"""Test company/owner filtering"""
# Test specific company
queryset = ParkFilter(data={"operator": str(self.operator1.id)}).qs
def test_operator_filtering(self):
"""Test operator filtering"""
# Test specific operator
queryset = ParkFilter(data={"operator": str(self.operator1.pk)}).qs
self.assertEqual(queryset.count(), 1)
self.assertIn(self.park1, queryset)
# Test other company
queryset = ParkFilter(data={"operator": str(self.operator2.id)}).qs
# Test other operator
queryset = ParkFilter(data={"operator": str(self.operator2.pk)}).qs
self.assertEqual(queryset.count(), 1)
self.assertIn(self.park2, queryset)
# Test parks without owner
queryset = ParkFilter(data={"has_owner": False}).qs
# Test parks without operator
queryset = ParkFilter(data={"has_operator": False}).qs
self.assertEqual(queryset.count(), 1)
self.assertIn(self.park3, queryset)
# Test parks with any owner
queryset = ParkFilter(data={"has_owner": True}).qs
# Test parks with any operator
queryset = ParkFilter(data={"has_operator": True}).qs
self.assertEqual(queryset.count(), 2)
self.assertIn(self.park1, queryset)
self.assertIn(self.park2, queryset)
@@ -217,7 +217,7 @@ class ParkFilterTests(TestCase):
queryset = ParkFilter(data={}).qs
self.assertEqual(queryset.count(), 3)
# Test invalid company ID
# Test invalid operator ID
queryset = ParkFilter(data={"operator": "99999"}).qs
self.assertEqual(queryset.count(), 0)

View File

@@ -25,7 +25,7 @@ class ParkModelTests(TestCase):
name="Test Park",
description="A test park",
status="OPERATING",
owner=self.operator
operator=self.operator
)
# Create location for the park