mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-20 15:31:08 -05:00
- Add complete backend/ directory with full Django application - Add frontend/ directory with Vite + TypeScript setup ready for Next.js - Add comprehensive shared/ directory with: - Complete documentation and memory-bank archives - Media files and avatars (letters, park/ride images) - Deployment scripts and automation tools - Shared types and utilities - Add architecture/ directory with migration guides - Configure pnpm workspace for monorepo development - Update .gitignore to exclude .django_tailwind_cli/ build artifacts - Preserve all historical documentation in shared/docs/memory-bank/ - Set up proper structure for full-stack development with shared resources
97 lines
2.5 KiB
Python
97 lines
2.5 KiB
Python
from django.contrib import admin
|
|
from django.contrib.gis.admin import GISModelAdmin
|
|
from .models.company import Company
|
|
from .models.rides import Ride
|
|
from .models.location import RideLocation
|
|
|
|
|
|
class ManufacturerAdmin(admin.ModelAdmin):
|
|
list_display = ("name", "headquarters", "website", "rides_count")
|
|
search_fields = ("name",)
|
|
|
|
def get_queryset(self, request):
|
|
return super().get_queryset(request).filter(roles__contains=["MANUFACTURER"])
|
|
|
|
|
|
class DesignerAdmin(admin.ModelAdmin):
|
|
list_display = ("name", "headquarters", "website")
|
|
search_fields = ("name",)
|
|
|
|
def get_queryset(self, request):
|
|
return super().get_queryset(request).filter(roles__contains=["DESIGNER"])
|
|
|
|
|
|
class RideLocationInline(admin.StackedInline):
|
|
"""Inline admin for RideLocation"""
|
|
|
|
model = RideLocation
|
|
extra = 0
|
|
fields = (
|
|
"park_area",
|
|
"point",
|
|
"entrance_notes",
|
|
"accessibility_notes",
|
|
)
|
|
|
|
|
|
class RideLocationAdmin(GISModelAdmin):
|
|
"""Admin for standalone RideLocation management"""
|
|
|
|
list_display = ("ride", "park_area", "has_coordinates", "created_at")
|
|
list_filter = ("park_area", "created_at")
|
|
search_fields = ("ride__name", "park_area", "entrance_notes")
|
|
readonly_fields = (
|
|
"latitude",
|
|
"longitude",
|
|
"coordinates",
|
|
"created_at",
|
|
"updated_at",
|
|
)
|
|
fieldsets = (
|
|
("Ride", {"fields": ("ride",)}),
|
|
(
|
|
"Location Information",
|
|
{
|
|
"fields": (
|
|
"park_area",
|
|
"point",
|
|
"latitude",
|
|
"longitude",
|
|
"coordinates",
|
|
),
|
|
"description": "Optional coordinates - not all rides need precise location tracking",
|
|
},
|
|
),
|
|
(
|
|
"Navigation Notes",
|
|
{
|
|
"fields": ("entrance_notes", "accessibility_notes"),
|
|
},
|
|
),
|
|
(
|
|
"Metadata",
|
|
{"fields": ("created_at", "updated_at"), "classes": ("collapse",)},
|
|
),
|
|
)
|
|
|
|
def latitude(self, obj):
|
|
return obj.latitude
|
|
|
|
latitude.short_description = "Latitude"
|
|
|
|
def longitude(self, obj):
|
|
return obj.longitude
|
|
|
|
longitude.short_description = "Longitude"
|
|
|
|
|
|
class RideAdmin(admin.ModelAdmin):
|
|
"""Enhanced Ride admin with location inline"""
|
|
|
|
inlines = [RideLocationInline]
|
|
|
|
|
|
admin.site.register(Company)
|
|
admin.site.register(Ride, RideAdmin)
|
|
admin.site.register(RideLocation, RideLocationAdmin)
|