Add operators and property owners functionality

- Implemented OperatorListView and OperatorDetailView for managing operators.
- Created corresponding templates for operator listing and detail views.
- Added PropertyOwnerListView and PropertyOwnerDetailView for managing property owners.
- Developed templates for property owner listing and detail views.
- Established relationships between parks and operators, and parks and property owners in the models.
- Created migrations to reflect the new relationships and fields in the database.
- Added admin interfaces for PropertyOwner management.
- Implemented tests for operators and property owners.
This commit is contained in:
pacnpal
2025-07-04 14:49:36 -04:00
parent 8360f3fd43
commit 751cd86a31
80 changed files with 2943 additions and 2358 deletions

View File

@@ -7,7 +7,7 @@ from django.contrib.gis.geos import Point
from django.http import HttpResponse
from typing import cast, Optional, Tuple
from .models import Park, ParkArea
from companies.models import Company
from operators.models import Operator
from location.models import Location
User = get_user_model()
@@ -38,7 +38,7 @@ class ParkModelTests(TestCase):
)
# Create test company
cls.company = Company.objects.create(
cls.operator = Operator.objects.create(
name='Test Company',
website='http://example.com'
)
@@ -46,7 +46,7 @@ class ParkModelTests(TestCase):
# Create test park
cls.park = Park.objects.create(
name='Test Park',
owner=cls.company,
owner=cls.operator,
status='OPERATING',
website='http://testpark.com'
)
@@ -57,7 +57,7 @@ class ParkModelTests(TestCase):
def test_park_creation(self) -> None:
"""Test park instance creation and field values"""
self.assertEqual(self.park.name, 'Test Park')
self.assertEqual(self.park.owner, self.company)
self.assertEqual(self.park.operator, self.operator)
self.assertEqual(self.park.status, 'OPERATING')
self.assertEqual(self.park.website, 'http://testpark.com')
self.assertTrue(self.park.slug)
@@ -92,7 +92,7 @@ class ParkModelTests(TestCase):
class ParkAreaTests(TestCase):
def setUp(self) -> None:
# Create test company
self.company = Company.objects.create(
self.operator = Operator.objects.create(
name='Test Company',
website='http://example.com'
)
@@ -100,7 +100,7 @@ class ParkAreaTests(TestCase):
# Create test park
self.park = Park.objects.create(
name='Test Park',
owner=self.company,
owner=self.operator,
status='OPERATING'
)
@@ -139,13 +139,13 @@ class ParkViewTests(TestCase):
email='test@example.com',
password='testpass123'
)
self.company = Company.objects.create(
self.operator = Operator.objects.create(
name='Test Company',
website='http://example.com'
)
self.park = Park.objects.create(
name='Test Park',
owner=self.company,
owner=self.operator,
status='OPERATING'
)
self.location = create_test_location(self.park)