feat: Implement MFA authentication, add ride statistics model, and update various services, APIs, and tests across the application.

This commit is contained in:
pacnpal
2025-12-28 17:32:53 -05:00
parent aa56c46c27
commit c95f99ca10
452 changed files with 7948 additions and 6073 deletions

View File

@@ -325,10 +325,7 @@ class ParkAdmin(
@admin.display(description="Avg Rating")
def average_rating(self, obj):
"""Display average park review rating."""
if hasattr(obj, "_avg_rating"):
rating = obj._avg_rating
else:
rating = obj.reviews.aggregate(avg=Avg("rating"))["avg"]
rating = obj._avg_rating if hasattr(obj, "_avg_rating") else obj.reviews.aggregate(avg=Avg("rating"))["avg"]
if rating:
stars = "" * int(rating) + "" * (5 - int(rating))
return format_html('<span style="color: gold;">{}</span> {:.1f}', stars, rating)