mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-20 12:31:22 -05:00
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:
96
templates/operators/operator_detail.html
Normal file
96
templates/operators/operator_detail.html
Normal file
@@ -0,0 +1,96 @@
|
||||
{% extends "base/base.html" %}
|
||||
{% load static %}
|
||||
|
||||
{% block title %}{{ operator.name }} - ThrillWiki{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container px-4 mx-auto sm:px-6 lg:px-8">
|
||||
<!-- Operator Header -->
|
||||
<div class="mb-8">
|
||||
<h1 class="text-4xl font-bold text-gray-900 dark:text-white mb-4">{{ operator.name }}</h1>
|
||||
|
||||
{% if operator.description %}
|
||||
<div class="prose dark:prose-invert max-w-none mb-6">
|
||||
<p class="text-lg text-gray-600 dark:text-gray-400">{{ operator.description }}</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<!-- Operator Details -->
|
||||
<div class="grid grid-cols-1 md:grid-cols-3 gap-4 mb-6">
|
||||
{% if operator.founded_year %}
|
||||
<div class="bg-white dark:bg-gray-800 rounded-lg p-4 shadow-sm">
|
||||
<h3 class="text-sm font-medium text-gray-500 dark:text-gray-400">Founded</h3>
|
||||
<p class="text-lg font-semibold text-gray-900 dark:text-white">{{ operator.founded_year }}</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if operator.headquarters %}
|
||||
<div class="bg-white dark:bg-gray-800 rounded-lg p-4 shadow-sm">
|
||||
<h3 class="text-sm font-medium text-gray-500 dark:text-gray-400">Headquarters</h3>
|
||||
<p class="text-lg font-semibold text-gray-900 dark:text-white">{{ operator.headquarters }}</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="bg-white dark:bg-gray-800 rounded-lg p-4 shadow-sm">
|
||||
<h3 class="text-sm font-medium text-gray-500 dark:text-gray-400">Parks Operated</h3>
|
||||
<p class="text-lg font-semibold text-gray-900 dark:text-white">{{ parks.count }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Parks Section -->
|
||||
{% if parks %}
|
||||
<div class="mb-8">
|
||||
<h2 class="text-2xl font-bold text-gray-900 dark:text-white mb-6">Parks Operated</h2>
|
||||
<div class="grid gap-6 md:grid-cols-2 lg:grid-cols-3">
|
||||
{% for park in parks %}
|
||||
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-md overflow-hidden">
|
||||
{% if park.main_image %}
|
||||
<img src="{{ park.main_image.url }}" alt="{{ park.name }}" class="w-full h-48 object-cover">
|
||||
{% endif %}
|
||||
|
||||
<div class="p-6">
|
||||
<h3 class="text-xl font-semibold text-gray-900 dark:text-white mb-2">
|
||||
<a href="{% url 'parks:park_detail' park.slug %}" class="hover:text-blue-600 dark:hover:text-blue-400">
|
||||
{{ park.name }}
|
||||
</a>
|
||||
</h3>
|
||||
|
||||
{% if park.location_display %}
|
||||
<p class="text-gray-600 dark:text-gray-400 mb-2">{{ park.location_display }}</p>
|
||||
{% endif %}
|
||||
|
||||
{% if park.opened_date %}
|
||||
<p class="text-sm text-gray-500 dark:text-gray-500">Opened {{ park.opened_date|date:"Y" }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="mb-8">
|
||||
<h2 class="text-2xl font-bold text-gray-900 dark:text-white mb-6">Parks Operated</h2>
|
||||
<div class="bg-gray-50 dark:bg-gray-800 rounded-lg p-8 text-center">
|
||||
<p class="text-gray-500 dark:text-gray-400">No parks currently operated by this company.</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<!-- Additional Information -->
|
||||
{% if operator.website %}
|
||||
<div class="mb-8">
|
||||
<h2 class="text-2xl font-bold text-gray-900 dark:text-white mb-4">Links</h2>
|
||||
<div class="bg-white dark:bg-gray-800 rounded-lg p-6 shadow-sm">
|
||||
<a href="{{ operator.website }}" target="_blank" rel="noopener noreferrer"
|
||||
class="inline-flex items-center text-blue-600 dark:text-blue-400 hover:text-blue-800 dark:hover:text-blue-300">
|
||||
Official Website
|
||||
<svg class="w-4 h-4 ml-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"></path>
|
||||
</svg>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
63
templates/operators/operator_list.html
Normal file
63
templates/operators/operator_list.html
Normal file
@@ -0,0 +1,63 @@
|
||||
{% extends "base/base.html" %}
|
||||
{% load static %}
|
||||
|
||||
{% block title %}Operators - ThrillWiki{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container px-4 mx-auto sm:px-6 lg:px-8">
|
||||
<!-- Header -->
|
||||
<div class="mb-8">
|
||||
<h1 class="text-3xl font-bold text-gray-900 dark:text-white">Park Operators</h1>
|
||||
<p class="mt-2 text-gray-600 dark:text-gray-400">Companies that operate theme parks around the world</p>
|
||||
</div>
|
||||
|
||||
<!-- Operators List -->
|
||||
<div class="grid gap-6 md:grid-cols-2 lg:grid-cols-3">
|
||||
{% for operator in operators %}
|
||||
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-md p-6">
|
||||
<h3 class="text-xl font-semibold text-gray-900 dark:text-white mb-2">
|
||||
<a href="{% url 'operators:operator_detail' operator.slug %}" class="hover:text-blue-600 dark:hover:text-blue-400">
|
||||
{{ operator.name }}
|
||||
</a>
|
||||
</h3>
|
||||
|
||||
{% if operator.description %}
|
||||
<p class="text-gray-600 dark:text-gray-400 mb-4">{{ operator.description|truncatewords:20 }}</p>
|
||||
{% endif %}
|
||||
|
||||
<div class="text-sm text-gray-500 dark:text-gray-500">
|
||||
{% if operator.parks_count %}
|
||||
<span class="inline-block mr-4">{{ operator.parks_count }} park{{ operator.parks_count|pluralize }}</span>
|
||||
{% endif %}
|
||||
{% if operator.founded_year %}
|
||||
<span class="inline-block">Founded {{ operator.founded_year }}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% empty %}
|
||||
<div class="col-span-full text-center py-12">
|
||||
<p class="text-gray-500 dark:text-gray-400">No operators found.</p>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<!-- Pagination -->
|
||||
{% if is_paginated %}
|
||||
<div class="mt-8 flex justify-center">
|
||||
<nav class="flex space-x-2">
|
||||
{% if page_obj.has_previous %}
|
||||
<a href="?page={{ page_obj.previous_page_number }}" class="px-3 py-2 bg-blue-600 text-white rounded hover:bg-blue-700">Previous</a>
|
||||
{% endif %}
|
||||
|
||||
<span class="px-3 py-2 bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded">
|
||||
Page {{ page_obj.number }} of {{ page_obj.paginator.num_pages }}
|
||||
</span>
|
||||
|
||||
{% if page_obj.has_next %}
|
||||
<a href="?page={{ page_obj.next_page_number }}" class="px-3 py-2 bg-blue-600 text-white rounded hover:bg-blue-700">Next</a>
|
||||
{% endif %}
|
||||
</nav>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user