mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-23 01:51:09 -05:00
Add comprehensive audit reports, design assessment, and non-authenticated features testing for ThrillWiki application
- Created critical functionality audit report identifying 7 critical issues affecting production readiness. - Added design assessment report highlighting exceptional design quality and minor cosmetic fixes needed. - Documented non-authenticated features testing results confirming successful functionality and public access. - Implemented ride search form with autocomplete functionality and corresponding templates for search results. - Developed tests for ride autocomplete functionality, ensuring proper filtering and authentication checks.
This commit is contained in:
@@ -63,14 +63,14 @@ class ParkFilter(LocationFilterMixin, RatingFilterMixin, DateRangeFilterMixin, F
|
||||
|
||||
# Ride and attraction filters
|
||||
min_rides = NumberFilter(
|
||||
field_name='current_ride_count',
|
||||
field_name='ride_count',
|
||||
lookup_expr='gte',
|
||||
validators=[validate_positive_integer],
|
||||
label=_("Minimum Rides"),
|
||||
help_text=_("Show parks with at least this many rides")
|
||||
)
|
||||
min_coasters = NumberFilter(
|
||||
field_name='current_coaster_count',
|
||||
field_name='coaster_count',
|
||||
lookup_expr='gte',
|
||||
validators=[validate_positive_integer],
|
||||
label=_("Minimum Roller Coasters"),
|
||||
|
||||
@@ -214,8 +214,8 @@ class ParkArea(TrackedModel):
|
||||
return f"{self.name} at {self.park.name}"
|
||||
|
||||
def save(self, *args: Any, **kwargs: Any) -> None:
|
||||
if not self.slug:
|
||||
self.slug = slugify(self.name)
|
||||
# Always update slug when name changes
|
||||
self.slug = slugify(self.name)
|
||||
super().save(*args, **kwargs)
|
||||
|
||||
def get_absolute_url(self) -> str:
|
||||
@@ -230,15 +230,17 @@ class ParkArea(TrackedModel):
|
||||
try:
|
||||
return cls.objects.get(slug=slug), False
|
||||
except cls.DoesNotExist:
|
||||
# Check historical slugs using pghistory
|
||||
history_model = cls.get_history_model()
|
||||
history = history_model.objects.filter(
|
||||
slug=slug
|
||||
).order_by('-pgh_created_at').first()
|
||||
# Check pghistory events
|
||||
event_model = getattr(cls, 'event_model', None)
|
||||
if event_model:
|
||||
historical_event = event_model.objects.filter(
|
||||
slug=slug
|
||||
).order_by('-pgh_created_at').first()
|
||||
|
||||
if historical_event:
|
||||
try:
|
||||
return cls.objects.get(pk=historical_event.pgh_obj_id), True
|
||||
except cls.DoesNotExist:
|
||||
pass
|
||||
|
||||
if history:
|
||||
try:
|
||||
return cls.objects.get(pk=history.pgh_obj_id), True
|
||||
except cls.DoesNotExist as e:
|
||||
raise cls.DoesNotExist("No park area found with this slug") from e
|
||||
raise cls.DoesNotExist("No park area found with this slug")
|
||||
|
||||
@@ -4,6 +4,7 @@ slug handling, status management, and location integration.
|
||||
"""
|
||||
from django.test import TestCase
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.db import IntegrityError
|
||||
from django.utils import timezone
|
||||
from datetime import date
|
||||
|
||||
@@ -192,12 +193,15 @@ class ParkAreaModelTests(TestCase):
|
||||
|
||||
def test_unique_together_constraint(self):
|
||||
"""Test unique_together constraint for park and slug"""
|
||||
from django.db import transaction
|
||||
|
||||
# Try to create area with same slug in same park
|
||||
with self.assertRaises(ValidationError):
|
||||
ParkArea.objects.create(
|
||||
park=self.park,
|
||||
name="Test Area" # Will generate same slug
|
||||
)
|
||||
with transaction.atomic():
|
||||
with self.assertRaises(IntegrityError):
|
||||
ParkArea.objects.create(
|
||||
park=self.park,
|
||||
name="Test Area" # Will generate same slug
|
||||
)
|
||||
|
||||
# Should be able to use same name in different park
|
||||
other_park = Park.objects.create(name="Other Park")
|
||||
|
||||
Reference in New Issue
Block a user