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

@@ -24,7 +24,7 @@ class ParkAutocomplete(BaseAutocomplete):
"""Return search results with related data."""
return (get_base_park_queryset()
.filter(name__icontains=search)
.select_related('owner')
.select_related('operator', 'property_owner')
.order_by('name'))
def format_result(self, park):
@@ -117,7 +117,8 @@ class ParkForm(forms.ModelForm):
fields = [
"name",
"description",
"owner",
"operator",
"property_owner",
"status",
"opening_date",
"closing_date",
@@ -145,7 +146,12 @@ class ParkForm(forms.ModelForm):
"rows": 2,
}
),
"owner": forms.Select(
"operator": forms.Select(
attrs={
"class": "w-full border-gray-300 rounded-lg form-select dark:border-gray-600 dark:bg-gray-700 dark:text-white"
}
),
"property_owner": forms.Select(
attrs={
"class": "w-full border-gray-300 rounded-lg form-select dark:border-gray-600 dark:bg-gray-700 dark:text-white"
}