mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-24 06:11:08 -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:
@@ -45,7 +45,6 @@ INSTALLED_APPS = [
|
||||
"autocomplete", # Django HTMX Autocomplete
|
||||
"core",
|
||||
"accounts",
|
||||
"companies",
|
||||
"parks",
|
||||
"rides",
|
||||
"reviews",
|
||||
@@ -54,6 +53,9 @@ INSTALLED_APPS = [
|
||||
"moderation",
|
||||
"history_tracking",
|
||||
"designers",
|
||||
"operators",
|
||||
"property_owners",
|
||||
"manufacturers",
|
||||
"analytics",
|
||||
"location",
|
||||
"search.apps.SearchConfig", # Add search app
|
||||
|
||||
@@ -22,7 +22,9 @@ urlpatterns = [
|
||||
path("rides/", include("rides.urls", namespace="rides")),
|
||||
# Other URLs
|
||||
path("reviews/", include("reviews.urls")),
|
||||
path("companies/", include("companies.urls")),
|
||||
path("operators/", include("operators.urls", namespace="operators")),
|
||||
path("property-owners/", include("property_owners.urls", namespace="property_owners")),
|
||||
path("manufacturers/", include("manufacturers.urls", namespace="manufacturers")),
|
||||
path("designers/", include("designers.urls", namespace="designers")),
|
||||
path("photos/", include("media.urls", namespace="photos")), # Add photos URLs
|
||||
path("search/", include("search.urls", namespace="search")),
|
||||
|
||||
@@ -5,7 +5,9 @@ from django.db.models.functions import Concat
|
||||
from django.core.cache import cache
|
||||
from parks.models import Park
|
||||
from rides.models import Ride
|
||||
from companies.models import Company, Manufacturer
|
||||
from operators.models import Operator
|
||||
from property_owners.models import PropertyOwner
|
||||
from manufacturers.models import Manufacturer
|
||||
from analytics.models import PageView
|
||||
from django.conf import settings
|
||||
import os
|
||||
@@ -109,12 +111,19 @@ class SearchView(TemplateView):
|
||||
Q(manufacturer__name__icontains=query)
|
||||
).select_related('park', 'coaster_stats').prefetch_related('photos')[:10]
|
||||
|
||||
# Search companies
|
||||
context['companies'] = Company.objects.filter(
|
||||
# Search operators
|
||||
context['operators'] = Operator.objects.filter(
|
||||
Q(name__icontains=query) |
|
||||
Q(headquarters__icontains=query) |
|
||||
Q(description__icontains=query)
|
||||
).prefetch_related('parks')[:10]
|
||||
).prefetch_related('operated_parks')[:10]
|
||||
|
||||
# Search property owners
|
||||
context['property_owners'] = PropertyOwner.objects.filter(
|
||||
Q(name__icontains=query) |
|
||||
Q(headquarters__icontains=query) |
|
||||
Q(description__icontains=query)
|
||||
).prefetch_related('owned_parks')[:10]
|
||||
|
||||
# Search manufacturers
|
||||
context['manufacturers'] = Manufacturer.objects.filter(
|
||||
|
||||
Reference in New Issue
Block a user