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

@@ -112,28 +112,55 @@
</div>
</div>
<!-- Companies Results -->
<!-- Operators Results -->
<div class="p-6 bg-white rounded-lg shadow dark:bg-gray-800">
<h2 class="mb-4 text-xl font-semibold">Companies</h2>
<h2 class="mb-4 text-xl font-semibold">Park Operators</h2>
<div class="grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-3">
{% for company in companies %}
{% for operator in operators %}
<div class="p-4 rounded-lg bg-gray-50 dark:bg-gray-700">
<h3 class="mb-2 text-lg font-semibold">
<a href="{% url 'companies:company_detail' company.slug %}"
<a href="{% url 'operators:operator_detail' operator.slug %}"
class="text-blue-600 hover:underline dark:text-blue-400">
{{ company.name }}
{{ operator.name }}
</a>
</h3>
{% if company.headquarters %}
<p class="mb-2 text-gray-600 dark:text-gray-400">{{ company.headquarters }}</p>
{% if operator.headquarters %}
<p class="mb-2 text-gray-600 dark:text-gray-400">{{ operator.headquarters }}</p>
{% endif %}
<div class="text-sm text-gray-500 dark:text-gray-400">
{{ company.parks.count }} parks owned
{{ operator.operated_parks.count }} parks operated
</div>
</div>
{% empty %}
<div class="py-4 text-center col-span-full">
<p class="text-gray-500 dark:text-gray-400">No companies found matching your search.</p>
<p class="text-gray-500 dark:text-gray-400">No operators found matching your search.</p>
</div>
{% endfor %}
</div>
</div>
<!-- Property Owners Results -->
<div class="p-6 bg-white rounded-lg shadow dark:bg-gray-800">
<h2 class="mb-4 text-xl font-semibold">Property Owners</h2>
<div class="grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-3">
{% for property_owner in property_owners %}
<div class="p-4 rounded-lg bg-gray-50 dark:bg-gray-700">
<h3 class="mb-2 text-lg font-semibold">
<a href="{% url 'property_owners:property_owner_detail' property_owner.slug %}"
class="text-blue-600 hover:underline dark:text-blue-400">
{{ property_owner.name }}
</a>
</h3>
{% if property_owner.headquarters %}
<p class="mb-2 text-gray-600 dark:text-gray-400">{{ property_owner.headquarters }}</p>
{% endif %}
<div class="text-sm text-gray-500 dark:text-gray-400">
{{ property_owner.owned_parks.count }} properties owned
</div>
</div>
{% empty %}
<div class="py-4 text-center col-span-full">
<p class="text-gray-500 dark:text-gray-400">No property owners found matching your search.</p>
</div>
{% endfor %}
</div>