mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-30 15:07:03 -05:00
feat: Implement MFA authentication, add ride statistics model, and update various services, APIs, and tests across the application.
This commit is contained in:
@@ -3,23 +3,23 @@ Custom managers and QuerySets for Rides models.
|
||||
Optimized queries following Django styleguide patterns.
|
||||
"""
|
||||
|
||||
from typing import Optional, List, Union
|
||||
from django.db.models import Q, F, Count, Prefetch
|
||||
|
||||
from django.db.models import Count, F, Prefetch, Q
|
||||
|
||||
from apps.core.managers import (
|
||||
BaseQuerySet,
|
||||
BaseManager,
|
||||
ReviewableQuerySet,
|
||||
BaseQuerySet,
|
||||
ReviewableManager,
|
||||
StatusQuerySet,
|
||||
ReviewableQuerySet,
|
||||
StatusManager,
|
||||
StatusQuerySet,
|
||||
)
|
||||
|
||||
|
||||
class RideQuerySet(StatusQuerySet, ReviewableQuerySet):
|
||||
"""Optimized QuerySet for Ride model."""
|
||||
|
||||
def by_category(self, *, category: Union[str, List[str]]):
|
||||
def by_category(self, *, category: str | list[str]):
|
||||
"""Filter rides by category."""
|
||||
if isinstance(category, list):
|
||||
return self.filter(category__in=category)
|
||||
@@ -119,10 +119,10 @@ class RideQuerySet(StatusQuerySet, ReviewableQuerySet):
|
||||
def search_by_specs(
|
||||
self,
|
||||
*,
|
||||
min_height: Optional[int] = None,
|
||||
max_height: Optional[int] = None,
|
||||
min_speed: Optional[float] = None,
|
||||
inversions: Optional[bool] = None,
|
||||
min_height: int | None = None,
|
||||
max_height: int | None = None,
|
||||
min_speed: float | None = None,
|
||||
inversions: bool | None = None,
|
||||
):
|
||||
"""Search rides by physical specifications."""
|
||||
queryset = self
|
||||
|
||||
Reference in New Issue
Block a user